Skip to content

Instantly share code, notes, and snippets.

@betterdatascience
Created October 28, 2020 06:45
Show Gist options
  • Save betterdatascience/b23fdd9dde3bcbdaddce5caa179b75ae to your computer and use it in GitHub Desktop.
Save betterdatascience/b23fdd9dde3bcbdaddce5caa179b75ae to your computer and use it in GitHub Desktop.
005_fastapi
import requests
new_measurement = {
'sepal_length': 5.7,
'sepal_width': 3.1,
'petal_length': 4.9,
'petal_width': 2.2
}
response = requests.post('http://127.0.0.1:8000/predict', json=new_measurement)
print(response.content)
>>> b'{"prediction":"virginica","probability":0.87}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment