Created
February 26, 2020 07:18
-
-
Save lakshay-arora/28e4dcf2875e950a4fe9ed08a2543b55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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