Tensorflow服务:Rest API返回“格式错误的请求"错误 [英] Tensorflow Serving: Rest API returns "Malformed request" error

查看:522
本文介绍了Tensorflow服务:Rest API返回“格式错误的请求"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tensorflow服务服务器(由docker运行)通过以下方式响应我的GET(和POST)请求:

Tensorflow Serving server (run with docker) responds to my GET (and POST) requests with this:

{ "error": "Malformed request: POST /v1/models/saved_model/" }

确实已经报告了相同的问题,但从未解决过(据说,这是一个StackOverflow问题,不是GitHub问题):

Precisely the same problem was already reported but never solved (supposedly, this is a StackOverflow kind of question, not a GitHub issue):

https://github.com/tensorflow/serving/issues/1085

https://github.com/tensorflow/serving/issues/1095

有什么想法吗?非常感谢.

Any ideas? Thank you very much.

推荐答案

我的方法存在两个问题:

There were two issues with my approach:

1)我的Tensorflow_model_server不支持状态检查请求(请参阅 https://github.com/tensorflow/serving/issues/1085 了解详情)

1) The status check request wasn't supported in my Tensorflow_model_server (see https://github.com/tensorflow/serving/issues/1085 for details)

2)更重要的是,在使用Windows时,您必须在JSON中使用引号引起来.因此,代替:

2) More importantly, when using Windows you must escape quotation marks in JSON. So instead of:

curl -XPOST http://localhost:8501/v1/models/saved_model:predict -d "{"instances":[{"features":[1,1,1,1,1,1,1,1,1,1]}]}"

我应该使用这个:

curl -XPOST http://localhost:8501/v1/models/saved_model:predict -d "{\"instances\":[{\"features\":[1,1,1,1,1,1,1,1,1,1]}]}"

这篇关于Tensorflow服务:Rest API返回“格式错误的请求"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆