Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created February 26, 2020 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshay-arora/28e4dcf2875e950a4fe9ed08a2543b55 to your computer and use it in GitHub Desktop.
Save lakshay-arora/28e4dcf2875e950a4fe9ed08a2543b55 to your computer and use it in GitHub Desktop.
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