Created
December 29, 2018 09:28
-
-
Save zldrobit/341115918cbec825d21d023cbc8a9626 to your computer and use it in GitHub Desktop.
This file contains 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 base64 | |
import requests | |
file = 'image.jpeg' | |
# predict is the method name | |
# /models/detection is the model path | |
url = 'http://localhost:8501/v1/models/detection:predict' | |
content = open(file, 'rb').read() | |
# encode binary data to b64 before json encode | |
content = base64.b64encode(content) | |
r = requests.post(url, json = { | |
'signature_name': 'sig_name', | |
'inputs': { | |
'images':[{"b64": content}] | |
} | |
}) | |
print(r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment