Spaces:
Running
Running
fahadcr14
commited on
Commit
·
a6dc0bf
1
Parent(s):
8cb2e47
V2
Browse files- templates/index.html +15 -25
templates/index.html
CHANGED
@@ -29,7 +29,8 @@
|
|
29 |
<section class="upload-section text-center py-16">
|
30 |
<h2 class="text-3xl font-semibold">Upload Your Image</h2>
|
31 |
<input type="file" id="file-upload" class="mt-4 p-2 border rounded" />
|
32 |
-
<button onclick="uploadImage()" class="mt-4 bg-blue-600 text-white p-2 rounded">Upload and Detect</button>
|
|
|
33 |
</section>
|
34 |
|
35 |
<!-- Result Section -->
|
@@ -41,35 +42,21 @@
|
|
41 |
<div id="result-container" class="mt-8 max-w-xl mx-auto"></div>
|
42 |
</section>
|
43 |
|
44 |
-
<!-- Workflow Cards -->
|
45 |
-
<section class="workflow py-16 bg-gray-200">
|
46 |
-
<div class="text-center">
|
47 |
-
<h2 class="text-3xl font-semibold">How It Works</h2>
|
48 |
-
</div>
|
49 |
-
<div class="flex justify-around mt-8">
|
50 |
-
<div class="card p-6 bg-white shadow-lg rounded-lg max-w-xs">
|
51 |
-
<h3 class="text-xl font-semibold">Upload Image</h3>
|
52 |
-
<p>Choose an image from your device to upload.</p>
|
53 |
-
</div>
|
54 |
-
<div class="card p-6 bg-white shadow-lg rounded-lg max-w-xs">
|
55 |
-
<h3 class="text-xl font-semibold">AI Process</h3>
|
56 |
-
<p>Our AI, trained on 100 million faces, processes your image.</p>
|
57 |
-
</div>
|
58 |
-
<div class="card p-6 bg-white shadow-lg rounded-lg max-w-xs">
|
59 |
-
<h3 class="text-xl font-semibold">Get Your Face Shape</h3>
|
60 |
-
<p>Our AI returns the most accurate prediction with up to 99.9% accuracy.</p>
|
61 |
-
</div>
|
62 |
-
</div>
|
63 |
-
</section>
|
64 |
-
|
65 |
<!-- Footer -->
|
66 |
-
<footer class="bg-blue-600 text-white text-center py-
|
67 |
<p>© 2024 Face Shape Detect. All rights reserved.</p>
|
68 |
</footer>
|
69 |
|
70 |
<script>
|
71 |
function uploadImage() {
|
|
|
|
|
72 |
const fileInput = document.getElementById('file-upload');
|
|
|
|
|
|
|
|
|
|
|
73 |
const formData = new FormData();
|
74 |
formData.append('file', fileInput.files[0]);
|
75 |
|
@@ -105,10 +92,13 @@
|
|
105 |
})
|
106 |
.catch(error => {
|
107 |
console.error('Error uploading image:', error);
|
|
|
|
|
|
|
|
|
|
|
108 |
});
|
109 |
}
|
110 |
</script>
|
111 |
-
|
112 |
-
|
113 |
</body>
|
114 |
</html>
|
|
|
29 |
<section class="upload-section text-center py-16">
|
30 |
<h2 class="text-3xl font-semibold">Upload Your Image</h2>
|
31 |
<input type="file" id="file-upload" class="mt-4 p-2 border rounded" />
|
32 |
+
<button id="upload-btn" onclick="uploadImage()" class="mt-4 bg-blue-600 text-white p-2 rounded">Upload and Detect</button>
|
33 |
+
<div id="loading" class="hidden mt-4">Loading...</div>
|
34 |
</section>
|
35 |
|
36 |
<!-- Result Section -->
|
|
|
42 |
<div id="result-container" class="mt-8 max-w-xl mx-auto"></div>
|
43 |
</section>
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<!-- Footer -->
|
46 |
+
<footer class="bg-blue-600 text-white text-center py-12">
|
47 |
<p>© 2024 Face Shape Detect. All rights reserved.</p>
|
48 |
</footer>
|
49 |
|
50 |
<script>
|
51 |
function uploadImage() {
|
52 |
+
const uploadBtn = document.getElementById('upload-btn');
|
53 |
+
const loadingDiv = document.getElementById('loading');
|
54 |
const fileInput = document.getElementById('file-upload');
|
55 |
+
|
56 |
+
// Disable the upload button to prevent multiple clicks
|
57 |
+
uploadBtn.disabled = true;
|
58 |
+
loadingDiv.classList.remove('hidden'); // Show loading animation
|
59 |
+
|
60 |
const formData = new FormData();
|
61 |
formData.append('file', fileInput.files[0]);
|
62 |
|
|
|
92 |
})
|
93 |
.catch(error => {
|
94 |
console.error('Error uploading image:', error);
|
95 |
+
})
|
96 |
+
.finally(() => {
|
97 |
+
// Enable the upload button and hide loading animation
|
98 |
+
uploadBtn.disabled = false;
|
99 |
+
loadingDiv.classList.add('hidden');
|
100 |
});
|
101 |
}
|
102 |
</script>
|
|
|
|
|
103 |
</body>
|
104 |
</html>
|