Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created September 20, 2019 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dipanjanS/ce57b5d6dc71826e098eb814ec5fb945 to your computer and use it in GitHub Desktop.
Save dipanjanS/ce57b5d6dc71826e098eb814ec5fb945 to your computer and use it in GitHub Desktop.
import base64
import requests
with open('sneaker.jpg', "rb") as imageFile:
img_b64enc = base64.b64encode(imageFile.read())
data = {'b64_img': img_b64enc}
API_URL = 'http://0.0.0.0:5000/apparel_classifier/api/v1/model2_predict'
# sending post request and saving response as response object
r = requests.post(url=API_URL, data=data)
r.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment