Last active
August 5, 2018 09:17
-
-
Save eavidan/07928337e2859bf8fa607f5693ee4a89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 pickle | |
import numpy as np | |
import requests | |
host = 'localhost' | |
port = '8501' | |
batch_size = 1 | |
image_path = "./mnist_image.pkl" | |
model_name = 'mnist' | |
signature_name = 'predict_images' | |
with open(image_path, 'rb') as f: | |
image = pickle.load(f) | |
batch = np.repeat(image, batch_size, axis=0).tolist() | |
json = { | |
"signature_name": signature_name, | |
"instances": batch | |
} | |
response = requests.post("http://%s:%s/v1/models/mnist:predict" % (host, port), json=json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment