-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommunicate_with_app_TST.py
40 lines (33 loc) · 1.2 KB
/
communicate_with_app_TST.py
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
31
32
33
34
35
36
37
38
39
import requests
import json
url = "http://localhost:5000/predict"
data_1 = {"gender": "female",
"race_ethnicity": 'group A',
"parental_level_of_education": "bachelor's degree",
"lunch": 'standard',
"test_preparation_course": 'completed',
"reading_score": 55,
"writing_score": 79}
data_2 = {"gender": "male",
"race_ethnicity": 'group E',
"parental_level_of_education": "master's degree",
"lunch": 'free/reduced',
"test_preparation_course": 'completed',
"reading_score": 15,
"writing_score": 22}
data_3 = {"gender": "male",
"race_ethnicity": 'group A',
"parental_level_of_education": "bachelor's degree",
"lunch": 'free/reduced',
"test_preparation_course": 'completed',
"reading_score": 95,
"writing_score": 92}
# Set the content type
headers = {"Content-Type": "application/json"}
# Make the request and display the response
resp = requests.post(url, json=data_1, headers=headers)
print(resp.text)
resp = requests.post(url, json=data_2, headers=headers)
print(resp.text)
resp = requests.post(url, json=data_3, headers=headers)
print(resp.text)