我已经为我的自定义模型提供了基于预先训练模型的手机对象检测API。因此,我想向服务发送请求:http://localhost:8501/v1/models/cellphone:predictHTTP \ REST API正常运行。
我使用了Docker和TensorFlow-serving。
对于请求,我使用了返回平均时间的python脚本,这是python脚本:https://raw.githubusercontent.com/tensorflow/serving/master/tensorflow_serving/example/resnet_client.py
唯一的更改是图像和我的服务器型号:
# The server URL specifies the endpoint of your server running the ResNet
# model with the name "resnet" and using the predict interface.
SERVER_URL = 'http://localhost:8501/v1/models/cellphone:predict'
# The image URL is the location of the image we should send to the server
IMAGE_URL = 'https://assets.kotsovolos.gr/product/199086-b.jpg'
并且当我运行$ python resnet_client.py时出现此错误:
Traceback (most recent call last): File "resnet_client.py", line 73, in <module> main() File `resnet_client.py", line 57, in main response.raise_for_status() File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:8501/v1/models/cellphone:predict`
有人可以帮助我发送正确的请求吗?谢谢你的进阶
系统信息Linux Ubuntu 16.04-python 3.5从二进制安装TensorFlow ServingTensorFlow ModelServer:2.1.0-rc1TensorFlow库:2.1.0