Spaces:
Runtime error
Runtime error
Create static/index.html
Browse files- static/index.html +33 -0
static/index.html
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Sketch Prediction</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Sketch Prediction</h1>
|
10 |
+
<form id="uploadForm" enctype="multipart/form-data">
|
11 |
+
<input type="file" id="fileInput" name="file" accept="image/*">
|
12 |
+
<button type="submit">Submit</button>
|
13 |
+
</form>
|
14 |
+
<div id="result"></div>
|
15 |
+
|
16 |
+
<script>
|
17 |
+
document.getElementById('uploadForm').addEventListener('submit', async function(event) {
|
18 |
+
event.preventDefault();
|
19 |
+
const formData = new FormData();
|
20 |
+
formData.append('file', document.getElementById('fileInput').files[0]);
|
21 |
+
|
22 |
+
const response = await fetch('/predict/', {
|
23 |
+
method: 'POST',
|
24 |
+
body: formData
|
25 |
+
});
|
26 |
+
|
27 |
+
const data = await response.blob();
|
28 |
+
const url = URL.createObjectURL(data);
|
29 |
+
document.getElementById('result').innerHTML = `<img src="${url}" alt="Prediction Result">`;
|
30 |
+
});
|
31 |
+
</script>
|
32 |
+
</body>
|
33 |
+
</html>
|