forked from ilirt123/ECE528-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.html
79 lines (73 loc) · 3.06 KB
/
api.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
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
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Calling Vertex AI Endpoint API from HTML</title>
</head>
<body>
<h1>Calling Vertex AI Endpoint API from HTML</h1>
<form onsubmit="callEndpoint(event)">
<label for="input1">usmers:</label>
<input type="number" name="usmers" id="usmers"><br>
<label for="input2">gender:</label>
<input type="number" name="gender" id="gender"><br>
<label for="input3">patient type:</label>
<input type="number" name="patient_type" id="patient_type"><br>
<label for="input4">intubated:</label>
<input type="number" name="intubated" id="intubated"><br>
<label for="input5">pneumonia:</label>
<input type="number" name="pneumonia" id="pneumonia"><br>
<label for="input6">age:</label>
<input type="number" name="age" id="age"><br>
<label for="input7">calsivication:</label>
<input type="number" name="clasiffication" id="clasiffication"><br>
<label for="input8e">medical type:</label>
<input type="number" name="medical_type" id="medical_type"><br>
<label for="input9">diabetes:</label>
<input type="number" name="diabetes" id="diabetes"><br>
<label for="input10">copd:</label>
<input type="number" name="copd" id="copd"><br>
<label for="input11">asthma:</label>
<input type="number" name="asthma" id="asthma"><br>
<label for="input12">inmsupr:</label>
<input type="number" name="inmsupr" id="inmsupr"><br>
<!-- Repeat for all 19 inputs -->
<button type="submit">Call Endpoint API</button>
</form>
<div id="result"></div>
<script>
function callEndpoint(event) {
event.preventDefault();
int usmers = document.getElementById("input1").value;
int gender = document.getElementById("input2").value;
int patient_type = document.getElementById("input3").value;
int intubated = document.getElementById("input4").value;
int pneumonia = document.getElementById("input5").value;
int age = document.getElementById("input6").value;
int clasiffication = document.getElementById("input7").value;
int medical_type = document.getElementById("input8").value;
int diabetes = document.getElementById("input9").value;
int copd = document.getElementById("input10").value;
int asthma = document.getElementById("input11").value;
int inmsupr = document.getElementById("input12").value;
// Repeat for all 19 inputs
fetch('https://"ece528-website".uc.gateway.dev/"1049492644805214208"', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'input': [[input1, input2, ...]] // put all 19 inputs in an array
})
})
.then(response => response.json())
.then(data => {
document.getElementById("result").innerHTML = JSON.stringify(data);
})
.catch(error => {
console.error('Error:', error);
});
}
</script>
</body>
</html>