Skip to content

Instantly share code, notes, and snippets.

@detrin
Created August 7, 2021 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save detrin/20a01f0aa2602be5e8d2d2c5b79f9a7e to your computer and use it in GitHub Desktop.
Save detrin/20a01f0aa2602be5e8d2d2c5b79f9a7e to your computer and use it in GitHub Desktop.
Serve ML model with Flask REST API - 4
import requests
test_data = [
[8.0, 390.0, 190.0, 3850.0, 8.5, 70.0, 0.0, 0.0, 1.0],
[8.0, 360.0, 215.0, 4615.0, 14.0, 70.0, 0.0, 0.0, 1.0],
[8.0, 304.0, 193.0, 4732.0, 18.5, 70.0, 0.0, 0.0, 1.0],
[4.0, 113.0, 95.0, 2228.0, 14.0, 71.0, 0.0, 1.0, 0.0],
[6.0, 232.0, 100.0, 2634.0, 13.0, 71.0, 0.0, 0.0, 1.0],
]
for data in test_data:
query = {"data": data}
response = requests.post("http://127.0.0.1:3000/predict", json=query)
print(response.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment