forked from udacity/nd00333-capstone
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathendpoint.py
More file actions
70 lines (61 loc) · 2.06 KB
/
endpoint.py
File metadata and controls
70 lines (61 loc) · 2.06 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
"""endpoint.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1RwZH8y2njnEaDnKjBtAlLLHkCWnS3frg
"""
import requests
import json
scoring_uri = "http://808cb467-696a-4c00-b51a-dc2a8dda2daf.southcentralus.azurecontainer.io/score"
data = {"data":
[
{
"city_development_index": 0.8270000000000001,
"gender": "Male",
"relevent_experience": "Has relevent experience",
"enrolled_university": "Full time course",
"education_level": "Graduate",
"major_discipline": "STEM",
"experience": 9,
"company_size": "<10",
"company_type": "Pvt Ltd",
"last_new_job": 1,
"training_hours": 21
},
{
"city_development_index": 0.95,
"gender": "Male",
"relevent_experience": "Has relevent experience",
"enrolled_university": "Full time course",
"education_level": "Masters",
"major_discipline": "STEM",
"experience": 9,
"company_size": "100-500",
"company_type": "Pvt Ltd",
"last_new_job": 5,
"training_hours": 60
},
{
"city_development_index": 0.6659999999999999,
"gender": "Female",
"relevent_experience": "Has relevent experience",
"enrolled_university": "no_enrollment",
"education_level": "Graduate",
"major_discipline": "STEM",
"experience": 18,
"company_size": "100-500",
"company_type": "Pvt Ltd",
"last_new_job": 4,
"training_hours": 43
}
]
}
# Convert to JSON string
input_data=json.dumps(data)
with open("data.json", "w") as _f:
_f.write(input_data)
# Set the content type
headers = {"Content-Type": "application/json"}
# Make the request and display the response
resp = requests.post(scoring_uri, input_data, headers=headers)
print(resp.json())