-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
43 lines (39 loc) · 1.49 KB
/
index.html
File metadata and controls
43 lines (39 loc) · 1.49 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pyro Predictor</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<button id="checkDangerLevel">Get Fire Danger Level</button>
<h2 id result>
<!--New background image and warning label-->
</h2>
</div>
<script>
document.getElementById("checkDanger").addEventListener("click", async () => {
try {
// Send POST request to backend
const response = await fetch("http://localhost/predict", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({}) // Replace with real input data
});
if (!response.ok) {
throw new Error("Server error");
}
const data = await response.json();
// Display the result
document.getElementById("result").innerText = `Fire Danger Level: ${data.danger?.toUpperCase() || "UNKNOWN"}`;
} catch (err) {
console.error(err);
document.getElementById("result").innerText = "Error contacting server.";
}
});
</script>
</body>
</html>