-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
34 lines (30 loc) · 1.06 KB
/
Copy pathindex.html
File metadata and controls
34 lines (30 loc) · 1.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
<html>
<head>
<title>ML Model</title>
<script>
function displayPrediction(data) {
document.getElementById('predictedClass').innerText = 'Class: ' + data.predicted_class;
document.getElementById('probabilities').innerText = 'Probabilities: ' + JSON.stringify(data.probability);
}
function submitForm(event) {
event.preventDefault();
var formData = new FormData(document.getElementById('uploadForm'));
fetch('/predict', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => displayPrediction(data))
.catch(error => console.error('Error:', error));
}
</script>
</head>
<body>
<form id="uploadForm" onsubmit="submitForm(event)">
<input type="file" name="file" required>
<input type="submit" value="Predict">
</form>
<div id="predictedClass"></div>
<div id="probabilities"></div>
</body>
</html>