forked from DanilZherebtsov/ml-docker-flask-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
32 lines (25 loc) · 703 Bytes
/
Copy pathclient.py
File metadata and controls
32 lines (25 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'''
Script for inferencing the deployed model
'''
import json
import requests
data = [[4.3, 3. , 1.1, 0.1],
[5.8, 4. , 1.2, 0.2],
[5.7, 4.4, 1.5, 0.4],
[5.4, 3.9, 1.3, 0.4],
[5.1, 3.5, 1.4, 0.3],
[5.7, 3.8, 1.7, 0.3],
[5.1, 3.8, 1.5, 0.3],
[5.4, 3.4, 1.7, 0.2],
[5.1, 3.7, 1.5, 0.4],
[4.6, 3.6, 1. , 0.2],
[5.1, 3.3, 1.7, 0.5],
[4.8, 3.4, 1.9, 0.2]]
url = 'http://0.0.0.0:8000/predict/'
predictions = []
for record in data:
payload = {'features': record}
payload = json.dumps(payload)
response = requests.post(url, data=payload)
predictions.append(response.json()['predicted_class'])
print(predictions)