html file
Browse files- index.html +118 -0
index.html
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Object Detection</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
10 |
+
background-image: url('https://analyticsindiamag.com/wp-content/uploads/2020/08/object-detection-illustration.png');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
margin: 0;
|
14 |
+
padding: 0;
|
15 |
+
display: flex;
|
16 |
+
justify-content: center;
|
17 |
+
align-items: center;
|
18 |
+
height: 100vh;
|
19 |
+
}
|
20 |
+
.container {
|
21 |
+
max-width: 400px;
|
22 |
+
background-color: rgba(255, 255, 255, 0.8);
|
23 |
+
border-radius: 10px;
|
24 |
+
padding: 40px;
|
25 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
|
26 |
+
}
|
27 |
+
h1 {
|
28 |
+
color: #393E46;
|
29 |
+
margin-bottom: 20px;
|
30 |
+
font-size: 24px;
|
31 |
+
text-align: center;
|
32 |
+
}
|
33 |
+
p {
|
34 |
+
color: #697C89;
|
35 |
+
margin-bottom: 30px;
|
36 |
+
text-align: center;
|
37 |
+
font-size: 14px;
|
38 |
+
}
|
39 |
+
input[type="file"] {
|
40 |
+
display: none;
|
41 |
+
}
|
42 |
+
.custom-file-upload {
|
43 |
+
display: block;
|
44 |
+
padding: 15px;
|
45 |
+
cursor: pointer;
|
46 |
+
background-color: #FF6B6B;
|
47 |
+
color: #FFF;
|
48 |
+
border: none;
|
49 |
+
border-radius: 5px;
|
50 |
+
transition: background-color 0.3s;
|
51 |
+
text-align: center;
|
52 |
+
font-size: 16px;
|
53 |
+
margin: 0 auto 20px auto;
|
54 |
+
max-width: 200px;
|
55 |
+
}
|
56 |
+
.custom-file-upload:hover {
|
57 |
+
background-color: #FF5252;
|
58 |
+
}
|
59 |
+
#output img {
|
60 |
+
max-width: 100%;
|
61 |
+
margin-top: 20px;
|
62 |
+
border-radius: 5px;
|
63 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
64 |
+
}
|
65 |
+
#loading {
|
66 |
+
display: none;
|
67 |
+
margin-top: 20px;
|
68 |
+
font-style: italic;
|
69 |
+
color: #697C89;
|
70 |
+
font-size: 16px;
|
71 |
+
text-align: center;
|
72 |
+
}
|
73 |
+
#loading.show {
|
74 |
+
display: block;
|
75 |
+
}
|
76 |
+
</style>
|
77 |
+
</head>
|
78 |
+
<body>
|
79 |
+
<div class="container">
|
80 |
+
<h1>Furniture Detection</h1>
|
81 |
+
<p>Please select an image file for furniture detection.</p>
|
82 |
+
<label for="file-upload" class="custom-file-upload">
|
83 |
+
Choose File
|
84 |
+
</label>
|
85 |
+
<input id="file-upload" type="file" accept="image/*">
|
86 |
+
<div id="loading">Processing...</div>
|
87 |
+
<div id="output"></div>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<script>
|
91 |
+
function detectObjects() {
|
92 |
+
var form_data = new FormData();
|
93 |
+
var file_input = document.getElementById('file-upload');
|
94 |
+
form_data.append('image', file_input.files[0]);
|
95 |
+
|
96 |
+
// Show loading message
|
97 |
+
document.getElementById('loading').classList.add('show');
|
98 |
+
document.getElementById('output').innerHTML = '';
|
99 |
+
|
100 |
+
fetch('/detect', {
|
101 |
+
method: 'POST',
|
102 |
+
body: form_data
|
103 |
+
})
|
104 |
+
.then(response => response.blob())
|
105 |
+
.then(data => {
|
106 |
+
var img_url = URL.createObjectURL(data);
|
107 |
+
var output_div = document.getElementById('output');
|
108 |
+
output_div.innerHTML = '<img src="' + img_url + '">';
|
109 |
+
// Hide loading message
|
110 |
+
document.getElementById('loading').classList.remove('show');
|
111 |
+
});
|
112 |
+
}
|
113 |
+
|
114 |
+
var fileUpload = document.getElementById('file-upload');
|
115 |
+
fileUpload.addEventListener('change', detectObjects);
|
116 |
+
</script>
|
117 |
+
</body>
|
118 |
+
</html>
|