Created
September 20, 2019 10:34
-
-
Save dipanjanS/c927d961cdb442e4405eadd98486876e 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
%%time | |
sample_test_data = test_images | |
sample_test_labels = test_labels | |
sample_test_data_processed = np.expand_dims(sample_test_data / 255., axis=3) | |
data = json.dumps({"signature_name": "serving_default", | |
"instances": sample_test_data_processed.tolist()}) | |
HEADERS = {'content-type': 'application/json'} | |
MODEL1_API_URL = 'http://localhost:8501/v1/models/fashion_model_serving/versions/1:predict' | |
json_response = requests.post(MODEL1_API_URL, data=data, headers=HEADERS) | |
predictions = json.loads(json_response.text)['predictions'] | |
predictions = np.argmax(np.array(predictions), axis=1) | |
prediction_labels = [class_names[p] for p in predictions] | |
len(prediction_labels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment