File size: 3,823 Bytes
498de04 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Object Detection</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-image: url('https://analyticsindiamag.com/wp-content/uploads/2020/08/object-detection-illustration.png');
background-size: cover;
background-position: center;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
max-width: 400px;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 10px;
padding: 40px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
h1 {
color: #393E46;
margin-bottom: 20px;
font-size: 24px;
text-align: center;
}
p {
color: #697C89;
margin-bottom: 30px;
text-align: center;
font-size: 14px;
}
input[type="file"] {
display: none;
}
.custom-file-upload {
display: block;
padding: 15px;
cursor: pointer;
background-color: #FF6B6B;
color: #FFF;
border: none;
border-radius: 5px;
transition: background-color 0.3s;
text-align: center;
font-size: 16px;
margin: 0 auto 20px auto;
max-width: 200px;
}
.custom-file-upload:hover {
background-color: #FF5252;
}
#output img {
max-width: 100%;
margin-top: 20px;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
#loading {
display: none;
margin-top: 20px;
font-style: italic;
color: #697C89;
font-size: 16px;
text-align: center;
}
#loading.show {
display: block;
}
</style>
</head>
<body>
<div class="container">
<h1>Furniture Detection</h1>
<p>Please select an image file for furniture detection.</p>
<label for="file-upload" class="custom-file-upload">
Choose File
</label>
<input id="file-upload" type="file" accept="image/*">
<div id="loading">Processing...</div>
<div id="output"></div>
</div>
<script>
function detectObjects() {
var form_data = new FormData();
var file_input = document.getElementById('file-upload');
form_data.append('image', file_input.files[0]);
// Show loading message
document.getElementById('loading').classList.add('show');
document.getElementById('output').innerHTML = '';
fetch('/detect', {
method: 'POST',
body: form_data
})
.then(response => response.blob())
.then(data => {
var img_url = URL.createObjectURL(data);
var output_div = document.getElementById('output');
output_div.innerHTML = '<img src="' + img_url + '">';
// Hide loading message
document.getElementById('loading').classList.remove('show');
});
}
var fileUpload = document.getElementById('file-upload');
fileUpload.addEventListener('change', detectObjects);
</script>
</body>
</html>
|