Skip to content

Instantly share code, notes, and snippets.

@himanshurawlani
Created December 26, 2019 19:16
Show Gist options
  • Save himanshurawlani/5602475d10732cb91d768d64f36897ee to your computer and use it in GitHub Desktop.
Save himanshurawlani/5602475d10732cb91d768d64f36897ee to your computer and use it in GitHub Desktop.
def make_serving_request(image_batch):
data = json.dumps({"signature_name": "serving_default",
"instances": image_batch.tolist()})
headers = {"content-type": "application/json"}
os.environ['NO_PROXY'] = 'localhost'
json_response = requests.post(
'http://localhost:8501/v1/models/flower_classifier:predict', data=data, headers=headers)
predictions = json.loads(json_response.text)['predictions']
return predictions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment