且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Tensorflow服务:Rest API返回“格式错误的请求"错误

更新时间:2023-12-02 19:04:04

我的方法存在两个问题:

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]}]}"