Created
September 20, 2019 10:36
-
-
Save dipanjanS/831aa430f15b20db54d0d7d9cfe7598b 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 | |
IMG_DIMS = (32, 32) | |
sample_test_data_processed = (np.array([resize_image_array(img, | |
img_size_dims=IMG_DIMS) | |
for img in np.stack([sample_test_data]*3, | |
axis=-1)])) / 255. | |
data = json.dumps({"signature_name": "serving_default", | |
"instances": sample_test_data_processed.tolist()}) | |
HEADERS = {'content-type': 'application/json'} | |
MODEL2_API_URL = 'http://localhost:8501/v1/models/fashion_model_serving/versions/2:predict' | |
json_response = requests.post(MODEL2_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