python-3.x - Tensorflow-Serving :requests.exceptions.HTTPError: 400 Client
问题描述
我已经为我的自定义模型提供了一个基于预训练模型的手机对象检测 API。所以,我想向服务发送请求: http://localhost:8501/v1/models/cellphone:predict HTTP\REST API 运行正常。
我使用了 Docker 和 TensorFlow 服务。
对于请求,我使用了一个返回平均时间的 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 Serving 从二进制 TensorFlow ModelServer 安装:2.1.0-rc1 TensorFlow Library:2.1.0
解决方案
推荐阅读
- sonarqube - SonarQube 是否总是需要外部代码覆盖工具来显示声纳服务器上的覆盖范围?
- r - 如何摆脱“案例和控件必须是数字的或有序的”。在 pROC 包中?
- python-3.x - 一种找到复杂算法时间复杂度的策略证明方法?
- javascript - easy-Autocomplete 实现问题:javascript 未执行且 JSON 未处理
- c# - Random() 创建相同的随机字母和数字
- python - 如何将信息从 Python 代码传递到 Web 信息显示?
- ios - 如何通过 iOS 中的键盘扩展更改文本字段中的字体输出
- c - 计算字符串中的一个字符 (C) - 问题
- vue.js - 用于 nuxt.js 构建的自定义 index.html
- javascript - useState 更新状态子数组对象不起作用