-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.py
More file actions
22 lines (17 loc) · 792 Bytes
/
Copy pathrequest.py
File metadata and controls
22 lines (17 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import requests
import pandas as pd
## Testing
# For testing I use the exaples from dataset but it can be replaced with user data
df = pd.read_csv('covtype.data', header=None)
df = df.drop(columns=[54])
df = df.iloc[:10]
data=df.values.tolist()
# Make request to api and display predictions
response = requests.post('http://localhost:5000/predict', json={'model': 'heuristic', 'inputs': data})
print(response.json())
response = requests.post('http://localhost:5000/predict', json={'model': 'baseline1', 'inputs': data})
print(response.json())
response = requests.post('http://localhost:5000/predict', json={'model': 'baseline2', 'inputs': data})
print(response.json())
response = requests.post('http://localhost:5000/predict', json={'model': 'nn', 'inputs': data})
print(response.json())