Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created February 26, 2020 07:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import json
import requests
# create a json string to ask query to the depoyed model
data = json.dumps({"signature_name": "serving_default",
"instances": test_images[0:3].tolist()})
# headers for the post request
headers = {"content-type": "application/json"}
# make the post request
json_response = requests.post('http://localhost:9000/v1/models/sample/versions/1:predict',
data=data,
headers=headers)
# get the predictions
predictions = json.loads(json_response.text)
predictions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment