forked from aritra43/steadystridenew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandoml.html
265 lines (247 loc) · 11.4 KB
/
randoml.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parkinson's Disease Prediction</title>
<link rel="stylesheet" href="output.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background: url('./homescreen.png') no-repeat center center fixed;
background-size: cover;
position: relative;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.8);
z-index: 1;
}
.form-container {
position: relative;
z-index: 2;
max-width: 500px;
margin: 5rem auto;
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
.form-container h2 {
font-size: 1.8rem;
font-weight: bold;
color: #2f855a;
margin-bottom: 1rem;
}
.form-container label {
display: block;
text-align: left;
font-weight: 600;
margin-bottom: 0.5rem;
color: #4a5568;
}
.form-container input,
.form-container select {
width: 100%;
padding: 0.75rem;
margin-bottom: 1rem;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
}
.form-container button {
background: #2f855a;
color: white;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 1rem;
}
.form-container button:hover {
background: #276749;
}
</style>
</head>
<body>
<div class="w-[100vw] h-[100vh] lg:hidden absolute">
<img class="absolute" src="./homescreennew.png" alt="">
</div>
<div class="hidden lg:block">
<img id="relimg" class="hidden lg:block lg:w-[100vw] lg:h-[100vh] lg:absolute" src="./homescreen.png" alt=""></div>
<div class="lg:h-20 lg:border-b-2 lg:border-green-400 relative lg:w-full lg:h-20 lg:border-b-2 lg:border-green-400 lg:relative ">
<div class="">
<div class="relative lg:hidden flex flex-row flex-wrap justify-between border-b-2 border-green-400 h-20">
<div class="text-green-700 relative text-2xl p-3 pt-6 ">SteadyStride</div>
<div class="mt-2"><a id="ham" class="text-[10vw] pr-5 pt-4 mt-4"' href="ham.html">≡</a></div>
</div>
<ul class="lg:flex lg:flex-row lg:justify-center lg:justify-evenly lg:flex lg:flex-row lg:justify-center lg:justify-evenly hidden">
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" href="home.html">Home</a></li>
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" href="about.html">About Us</a></li>
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" href="randoml.html">Tremor Prediction</a></li>
<div class="">
<h1 class="bg-gradient-to-r from-green-900 to-green-700 bg-clip-text p-5 text-3xl font-bold text-transparent lg:bg-gradient-to-r from-green-900 to-green-700 lg:bg-clip-text lg:p-5 lg:text-3xl lg:font-bold lg:text-transparent ">SteadyStride</h1>
</div>
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" href="report.html">Report</a></li>
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" href="home.html#footer">Contact Us</a></li>
<li class="p-7 font-semibold text-green-800"><a class="hover:bg-green-900 hover:text-green-400 hover:rounded-xl p-3 transition-colors duration-[0.4s] transition-all" id="new" href="signIn.html">Logout</a></li>
</ul>
</div>
<div class="form-container">
<h2>Parkinson's Disease Prediction Survey</h2>
<form id="parkinsonsForm" onsubmit="return false;">
<div>
<label for="tremor">Tremor:</label>
<select id="tremor" name="tremor" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<div>
<label for="slowness">Slowness:</label>
<select id="slowness" name="slowness" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<div>
<label for="rigidity">Rigidity:</label>
<select id="rigidity" name="rigidity" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<div>
<label for="lossOfSmell">Loss of Smell:</label>
<select id="lossOfSmell" name="lossOfSmell" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<div>
<label for="familyHistory">Family History:</label>
<select id="familyHistory" name="familyHistory" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<div>
<label for="numAncestors">Number of Ancestors with Parkinson's:</label>
<input type="number" id="numAncestors" name="numAncestors" min="0" max="5" placeholder="Enter a number" required>
</div>
<div>
<label for="numMaleAncestors">Number of Male Ancestors:</label>
<input type="number" id="numMaleAncestors" name="numMaleAncestors" min="0" max="5" placeholder="Enter a number" required>
</div>
<div>
<label for="pastHeadInjury">Past Severe Head Injury:</label>
<select id="pastHeadInjury" name="pastHeadInjury" required>
<option value="">Choose...</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<button type="button" onclick="submitForm()">Submit</button>
</form>
</div>
<script>
async function submitForm() {
const form = document.getElementById("parkinsonsForm");
if (!form.checkValidity()) {
form.reportValidity();
return;
}
const numAncestors = parseInt(document.getElementById("numAncestors").value);
const numMaleAncestors = parseInt(document.getElementById("numMaleAncestors").value);
if (numAncestors > 5 || numMaleAncestors > 5) {
alert("The number of ancestors or male ancestors cannot be greater than 5.");
return;
}
const tremor = parseInt(document.getElementById("tremor").value);
const slowness = parseInt(document.getElementById("slowness").value);
const rigidity = parseInt(document.getElementById("rigidity").value);
const lossOfSmell = parseInt(document.getElementById("lossOfSmell").value);
const familyHistory = parseInt(document.getElementById("familyHistory").value);
const pastHeadInjury = parseInt(document.getElementById("pastHeadInjury").value);
const result = await makeRequest(
tremor,
slowness,
rigidity,
lossOfSmell,
familyHistory,
numAncestors,
numMaleAncestors,
pastHeadInjury
);
if (result) {
alert("Prediction: " + JSON.stringify(result));
} else {
alert("Failed to get a prediction. Please try again later.");
}
}
async function makeRequest(
tremor,
slowness,
rigidity,
loss_of_smell,
family_history,
num_ancestors,
male_ancestors,
past_head_injury
) {
const urls = [
" https://4394-103-23-29-125.ngrok-free.app/predict",
"https://6174-103-23-29-122.ngrok-free.app/predict",
"https://2a2c-103-23-29-125.ngrok-free.app/predict",
];
const payload = {
kwargs: {
tremor: tremor,
slowness: slowness,
rigidity: rigidity,
loss_of_smell: loss_of_smell,
family_history: family_history,
num_ancestors: num_ancestors,
male_ancestors: male_ancestors,
past_head_injury: past_head_injury,
},
};
for (const url of urls) {
try {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"ngrok-skip-browser-warning": "true",
},
body: JSON.stringify(payload),
});
if (response.ok) {
const data = await response.json();
console.log("Response from", url, ":", data);
return data;
} else {
console.error("Error from", url, ":", response.status, await response.text());
}
} catch (error) {
console.error("Fetch failed for", url, ":", error);
}
}
console.error("All servers failed. Unable to complete the request.");
return null;
}
</script>
</body>
</html>