Skip to content

Instantly share code, notes, and snippets.

@naxty
Created September 9, 2019 06:06
Show Gist options
  • Save naxty/324bd20378c6c0d69f0eeb37804285ca to your computer and use it in GitHub Desktop.
Save naxty/324bd20378c6c0d69f0eeb37804285ca to your computer and use it in GitHub Desktop.
REST Client for local seldon core docker container
from PIL import Image
import numpy as np
import requests
path_to_image = "images/smile.jpg"
image = Image.open(path_to_image).convert('L')
resized = image.resize((64, 64))
values = np.array(resized).reshape(1, 1, 64, 64)
req = requests.post("http://localhost:5000/predict", json={"data":{"ndarray": values.tolist()}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment