forked from ilirt123/ECE528-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modelAPI.html
30 lines (30 loc) · 1.12 KB
/
modelAPI.html
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
<!DOCTYPE html>
<html>
<head>
<title>Call REST API</title>
<script>
function callApi() {
const data = {
"instances": [
{ "age": 20, "gender": "Male", "patient_type": 1, "intubated": 0, "pneumonia": 0, "clasiffication": 1, "medical_type": 1, "diabetes": 0, "copd": 0, "asthma": 0, "inmsupr": 0, "hypertension": 0, "other_disease": 0, "cardiovascular": 0, "obesity": 0, "renal_chronic": 0, "tobacco": 0, "icu": 0, "pregnancy": 0 },
]
};
const options = {
method: "POST",
headers: {
"Authorization": "Bearer 4/0AWtgzh4SVyLh7vdAFQENMF1wkhwUKgU7UFWn3BHlV9ny-OYjGi0xZQI7XftcxnIH1qiLlA",
"Content-Type": "application/json"
},
body: JSON.stringify(data)
};
fetch("https://us-central1-aiplatform.googleapis.com/v1/projects/ece528-website/locations/us-central1/endpoints/1049492644805214208:predict", options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
}
</script>
</head>
<body>
<button onclick="callApi()">Call API</button>
</body>
</html>