Reputation: 615
I'm new tensorflow-serving.
i tried to send request(POST) to tensorflow server using python3,
but when i send reqeust, i got <400>
, bad request
.
but when i send curl on terminal, it's work.
curl -d '{"instances": [3]}' -X POST http://localhost:8501/v1/models/hello_world:predict
this is my python code.
import requests
import json
urls = 'http://localhost:8501/v1/models/chachacha:predict'
data = {"instances": 2858}
j_data = json.dumps(data)
r = requests.post(urls, json=j_data)
print(r)
error message :
<Response [400]>
Thank you for any advice!
Upvotes: 1
Views: 438
Reputation: 804
try this
data = { "instances": [values]}
payld = json.dumps(data)
ret = requests.post(url, data=payld)
Upvotes: 2