Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +266 -49
templates/index.html
CHANGED
|
@@ -3,17 +3,28 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
| 10 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
@keyframes pulse-border {
|
| 12 |
-
0% { box-shadow: 0 0 0 0 rgba(
|
| 13 |
-
70% { box-shadow: 0 0 0 10px rgba(
|
| 14 |
-
100% { box-shadow: 0 0 0 0 rgba(
|
| 15 |
}
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
.preview-container {
|
| 18 |
position: relative;
|
| 19 |
aspect-ratio: 1;
|
|
@@ -38,6 +49,24 @@
|
|
| 38 |
transform: scale(1.05);
|
| 39 |
}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
.loading-overlay {
|
| 42 |
position: fixed;
|
| 43 |
top: 0;
|
|
@@ -57,19 +86,16 @@
|
|
| 57 |
height: 50px;
|
| 58 |
}
|
| 59 |
|
| 60 |
-
@keyframes spin {
|
| 61 |
-
100% { transform: rotate(360deg); }
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
.btn-primary {
|
| 65 |
-
background: linear-gradient(135deg,
|
| 66 |
transition: all 0.3s ease;
|
| 67 |
animation: pulse-border 2s infinite;
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
.btn-primary:hover {
|
| 71 |
transform: translateY(-2px);
|
| 72 |
-
box-shadow: 0 4px 12px rgba(
|
| 73 |
}
|
| 74 |
|
| 75 |
.result-card {
|
|
@@ -94,11 +120,75 @@
|
|
| 94 |
width: 80px;
|
| 95 |
height: 80px;
|
| 96 |
transition: transform 0.3s ease;
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
.github-corner:hover {
|
| 100 |
transform: scale(1.1);
|
| 101 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
</style>
|
| 103 |
</head>
|
| 104 |
<body class="bg-gradient-to-br from-gray-100 to-gray-200 min-h-screen font-sans">
|
|
@@ -108,65 +198,63 @@
|
|
| 108 |
</svg>
|
| 109 |
</div>
|
| 110 |
|
|
|
|
| 111 |
<nav class="bg-white shadow-lg">
|
| 112 |
<div class="container mx-auto px-6 py-4">
|
| 113 |
<div class="flex items-center justify-between">
|
| 114 |
<div class="flex items-center">
|
| 115 |
<i class="fas fa-brain text-4xl text-blue-600 mr-3"></i>
|
| 116 |
-
<
|
| 117 |
</div>
|
| 118 |
<div class="flex items-center space-x-4">
|
| 119 |
-
<
|
| 120 |
<i class="fas fa-question-circle text-xl"></i>
|
| 121 |
-
</
|
| 122 |
-
<
|
| 123 |
<i class="fas fa-cog text-xl"></i>
|
| 124 |
-
</
|
| 125 |
</div>
|
| 126 |
</div>
|
| 127 |
</div>
|
| 128 |
</nav>
|
| 129 |
|
|
|
|
| 130 |
<main class="container mx-auto p-6">
|
| 131 |
<div class="grid md:grid-cols-2 gap-8">
|
| 132 |
<!-- Section de capture -->
|
| 133 |
<div class="bg-white rounded-xl shadow-xl p-6 animate__animated animate__fadeInLeft">
|
| 134 |
-
<h2 class="
|
| 135 |
-
<i class="fas fa-camera
|
| 136 |
Capture d'Images
|
| 137 |
</h2>
|
| 138 |
|
| 139 |
<div class="space-y-4">
|
| 140 |
<div class="flex space-x-4">
|
| 141 |
-
<
|
| 142 |
<i class="fas fa-upload mr-2"></i>
|
| 143 |
Importer
|
| 144 |
-
</
|
| 145 |
<button id="cameraBtn" class="bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-lg flex items-center transition-all">
|
| 146 |
<i class="fas fa-video mr-2"></i>
|
| 147 |
Caméra
|
| 148 |
</button>
|
| 149 |
</div>
|
| 150 |
|
| 151 |
-
<input type="file" id="fileInput" class="hidden" accept="image/*">
|
| 152 |
-
<video id="video" class="camera-feed w-full hidden" autoplay></video>
|
| 153 |
|
| 154 |
<div class="grid grid-cols-2 gap-4">
|
| 155 |
-
<div class="preview-container
|
| 156 |
<div id="preview1" class="preview-image"></div>
|
| 157 |
-
<
|
| 158 |
-
<
|
| 159 |
-
|
| 160 |
-
</button>
|
| 161 |
-
</div>
|
| 162 |
</div>
|
| 163 |
-
<div class="preview-container
|
| 164 |
<div id="preview2" class="preview-image"></div>
|
| 165 |
-
<
|
| 166 |
-
<
|
| 167 |
-
|
| 168 |
-
</button>
|
| 169 |
-
</div>
|
| 170 |
</div>
|
| 171 |
</div>
|
| 172 |
</div>
|
|
@@ -174,15 +262,15 @@
|
|
| 174 |
|
| 175 |
<!-- Section des résultats -->
|
| 176 |
<div class="bg-white rounded-xl shadow-xl p-6 animate__animated animate__fadeInRight">
|
| 177 |
-
<h2 class="
|
| 178 |
-
<i class="fas fa-chart-bar
|
| 179 |
Résultats
|
| 180 |
</h2>
|
| 181 |
|
| 182 |
<div id="results" class="result-card p-4 rounded-lg bg-gray-50">
|
| 183 |
<div class="text-center text-gray-500">
|
| 184 |
<i class="fas fa-upload text-4xl mb-3"></i>
|
| 185 |
-
<p>Importez ou capturez deux images pour démarrer l'analyse</p>
|
| 186 |
</div>
|
| 187 |
</div>
|
| 188 |
|
|
@@ -195,19 +283,130 @@
|
|
| 195 |
</main>
|
| 196 |
|
| 197 |
<!-- GitHub Corner -->
|
| 198 |
-
<a href="https://github.com/Yusufibin" class="github-corner" target="_blank">
|
| 199 |
-
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:
|
| 200 |
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
| 201 |
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
|
| 202 |
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
|
| 203 |
</svg>
|
| 204 |
</a>
|
| 205 |
|
|
|
|
| 206 |
<script>
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
function showResults(data) {
|
| 212 |
const resultsDiv = document.getElementById('results');
|
| 213 |
resultsDiv.classList.remove('show');
|
|
@@ -222,19 +421,39 @@
|
|
| 222 |
${data.verified ? 'Visages identiques' : 'Visages différents'}
|
| 223 |
</h3>
|
| 224 |
<div class="space-y-2">
|
| 225 |
-
<p
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
| 229 |
</div>
|
| 230 |
</div>
|
| 231 |
</div>
|
| 232 |
`;
|
| 233 |
resultsDiv.classList.add('show');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
}, 300);
|
| 235 |
}
|
| 236 |
|
| 237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
function showLoading() {
|
| 239 |
document.querySelector('.loading-overlay').style.display = 'flex';
|
| 240 |
}
|
|
@@ -242,8 +461,6 @@
|
|
| 242 |
function hideLoading() {
|
| 243 |
document.querySelector('.loading-overlay').style.display = 'none';
|
| 244 |
}
|
| 245 |
-
|
| 246 |
-
// Le reste du code JavaScript original avec les gestionnaires d'événements...
|
| 247 |
</script>
|
| 248 |
</body>
|
| 249 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>FaceAI Pro - Reconnaissance Faciale Avancée</title>
|
| 7 |
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
| 10 |
<style>
|
| 11 |
+
:root {
|
| 12 |
+
--primary-color: #4f46e5;
|
| 13 |
+
--secondary-color: #3b82f6;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
/* Animations */
|
| 17 |
@keyframes pulse-border {
|
| 18 |
+
0% { box-shadow: 0 0 0 0 rgba(var(--primary-color), 0.7); }
|
| 19 |
+
70% { box-shadow: 0 0 0 10px rgba(var(--primary-color), 0); }
|
| 20 |
+
100% { box-shadow: 0 0 0 0 rgba(var(--primary-color), 0); }
|
| 21 |
}
|
| 22 |
|
| 23 |
+
@keyframes spin {
|
| 24 |
+
100% { transform: rotate(360deg); }
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/* Composants */
|
| 28 |
.preview-container {
|
| 29 |
position: relative;
|
| 30 |
aspect-ratio: 1;
|
|
|
|
| 49 |
transform: scale(1.05);
|
| 50 |
}
|
| 51 |
|
| 52 |
+
.delete-btn {
|
| 53 |
+
position: absolute;
|
| 54 |
+
bottom: 0.5rem;
|
| 55 |
+
right: 0.5rem;
|
| 56 |
+
background-color: rgba(239, 68, 68, 0.8); /* Red-500 with opacity */
|
| 57 |
+
color: white;
|
| 58 |
+
padding: 0.3rem;
|
| 59 |
+
border-radius: 50%;
|
| 60 |
+
opacity: 0;
|
| 61 |
+
transition: opacity 0.3s ease;
|
| 62 |
+
cursor: pointer;
|
| 63 |
+
z-index: 10;
|
| 64 |
+
}
|
| 65 |
+
.preview-container:hover .delete-btn {
|
| 66 |
+
opacity: 1;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
.loading-overlay {
|
| 71 |
position: fixed;
|
| 72 |
top: 0;
|
|
|
|
| 86 |
height: 50px;
|
| 87 |
}
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
.btn-primary {
|
| 90 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
| 91 |
transition: all 0.3s ease;
|
| 92 |
animation: pulse-border 2s infinite;
|
| 93 |
+
font-weight: 600;
|
| 94 |
}
|
| 95 |
|
| 96 |
.btn-primary:hover {
|
| 97 |
transform: translateY(-2px);
|
| 98 |
+
box-shadow: 0 4px 12px rgba(var(--primary-color), 0.4);
|
| 99 |
}
|
| 100 |
|
| 101 |
.result-card {
|
|
|
|
| 120 |
width: 80px;
|
| 121 |
height: 80px;
|
| 122 |
transition: transform 0.3s ease;
|
| 123 |
+
z-index: 1001; /* Ensure it's above the loading overlay */
|
| 124 |
}
|
| 125 |
|
| 126 |
.github-corner:hover {
|
| 127 |
transform: scale(1.1);
|
| 128 |
}
|
| 129 |
+
|
| 130 |
+
/* Nouvelles classes */
|
| 131 |
+
.section-title {
|
| 132 |
+
font-size: 1.5rem;
|
| 133 |
+
font-weight: 700;
|
| 134 |
+
color: #374151;
|
| 135 |
+
margin-bottom: 1.5rem;
|
| 136 |
+
display: flex;
|
| 137 |
+
align-items: center;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.section-title i {
|
| 141 |
+
color: var(--primary-color);
|
| 142 |
+
margin-right: 0.75rem;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.input-hidden {
|
| 146 |
+
display: none;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
.comparison-result {
|
| 150 |
+
font-size: 1.1rem;
|
| 151 |
+
margin-bottom: 0.5rem;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.comparison-result.positive {
|
| 155 |
+
color: #28a745; /* Green */
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.comparison-result.negative {
|
| 159 |
+
color: #dc3545; /* Red */
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.progress-bar {
|
| 163 |
+
height: 0.75rem;
|
| 164 |
+
background-color: #e0e7ff;
|
| 165 |
+
border-radius: 0.375rem;
|
| 166 |
+
margin-bottom: 1rem;
|
| 167 |
+
overflow: hidden;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.progress-bar-fill {
|
| 171 |
+
height: 100%;
|
| 172 |
+
background-color: var(--primary-color);
|
| 173 |
+
width: 0%;
|
| 174 |
+
transition: width 0.5s ease;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.progress-bar-fill.show {
|
| 178 |
+
animation: progress-animation 2s ease-in-out;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
@keyframes progress-animation {
|
| 182 |
+
0% { width: 0%; }
|
| 183 |
+
100% { width: var(--progress-value, 0%); }
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
/* Responsiveness */
|
| 187 |
+
@media (max-width: 768px) {
|
| 188 |
+
.preview-container {
|
| 189 |
+
margin-bottom: 1rem;
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
</style>
|
| 193 |
</head>
|
| 194 |
<body class="bg-gradient-to-br from-gray-100 to-gray-200 min-h-screen font-sans">
|
|
|
|
| 198 |
</svg>
|
| 199 |
</div>
|
| 200 |
|
| 201 |
+
<!-- Navigation -->
|
| 202 |
<nav class="bg-white shadow-lg">
|
| 203 |
<div class="container mx-auto px-6 py-4">
|
| 204 |
<div class="flex items-center justify-between">
|
| 205 |
<div class="flex items-center">
|
| 206 |
<i class="fas fa-brain text-4xl text-blue-600 mr-3"></i>
|
| 207 |
+
<a href="/" class="text-2xl font-bold text-gray-800 hover:text-blue-700 transition-colors">FaceAI Pro</a>
|
| 208 |
</div>
|
| 209 |
<div class="flex items-center space-x-4">
|
| 210 |
+
<a href="#" class="text-gray-600 hover:text-blue-600 transition-colors">
|
| 211 |
<i class="fas fa-question-circle text-xl"></i>
|
| 212 |
+
</a>
|
| 213 |
+
<a href="#" class="text-gray-600 hover:text-blue-600 transition-colors">
|
| 214 |
<i class="fas fa-cog text-xl"></i>
|
| 215 |
+
</a>
|
| 216 |
</div>
|
| 217 |
</div>
|
| 218 |
</div>
|
| 219 |
</nav>
|
| 220 |
|
| 221 |
+
<!-- Contenu principal -->
|
| 222 |
<main class="container mx-auto p-6">
|
| 223 |
<div class="grid md:grid-cols-2 gap-8">
|
| 224 |
<!-- Section de capture -->
|
| 225 |
<div class="bg-white rounded-xl shadow-xl p-6 animate__animated animate__fadeInLeft">
|
| 226 |
+
<h2 class="section-title">
|
| 227 |
+
<i class="fas fa-camera"></i>
|
| 228 |
Capture d'Images
|
| 229 |
</h2>
|
| 230 |
|
| 231 |
<div class="space-y-4">
|
| 232 |
<div class="flex space-x-4">
|
| 233 |
+
<label for="fileInput" class="btn-primary text-white px-6 py-3 rounded-lg flex items-center cursor-pointer">
|
| 234 |
<i class="fas fa-upload mr-2"></i>
|
| 235 |
Importer
|
| 236 |
+
</label>
|
| 237 |
<button id="cameraBtn" class="bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-lg flex items-center transition-all">
|
| 238 |
<i class="fas fa-video mr-2"></i>
|
| 239 |
Caméra
|
| 240 |
</button>
|
| 241 |
</div>
|
| 242 |
|
| 243 |
+
<input type="file" id="fileInput" class="input-hidden" accept="image/*" multiple>
|
| 244 |
+
<video id="video" class="camera-feed w-full hidden" autoplay muted playsinline></video>
|
| 245 |
|
| 246 |
<div class="grid grid-cols-2 gap-4">
|
| 247 |
+
<div class="preview-container">
|
| 248 |
<div id="preview1" class="preview-image"></div>
|
| 249 |
+
<button class="delete-btn" data-target="preview1" title="Supprimer">
|
| 250 |
+
<i class="fas fa-times"></i>
|
| 251 |
+
</button>
|
|
|
|
|
|
|
| 252 |
</div>
|
| 253 |
+
<div class="preview-container">
|
| 254 |
<div id="preview2" class="preview-image"></div>
|
| 255 |
+
<button class="delete-btn" data-target="preview2" title="Supprimer">
|
| 256 |
+
<i class="fas fa-times"></i>
|
| 257 |
+
</button>
|
|
|
|
|
|
|
| 258 |
</div>
|
| 259 |
</div>
|
| 260 |
</div>
|
|
|
|
| 262 |
|
| 263 |
<!-- Section des résultats -->
|
| 264 |
<div class="bg-white rounded-xl shadow-xl p-6 animate__animated animate__fadeInRight">
|
| 265 |
+
<h2 class="section-title">
|
| 266 |
+
<i class="fas fa-chart-bar"></i>
|
| 267 |
Résultats
|
| 268 |
</h2>
|
| 269 |
|
| 270 |
<div id="results" class="result-card p-4 rounded-lg bg-gray-50">
|
| 271 |
<div class="text-center text-gray-500">
|
| 272 |
<i class="fas fa-upload text-4xl mb-3"></i>
|
| 273 |
+
<p>Importez ou capturez deux images pour démarrer l'analyse.</p>
|
| 274 |
</div>
|
| 275 |
</div>
|
| 276 |
|
|
|
|
| 283 |
</main>
|
| 284 |
|
| 285 |
<!-- GitHub Corner -->
|
| 286 |
+
<a href="https://github.com/Yusufibin" class="github-corner" target="_blank" aria-label="Voir le code source sur GitHub">
|
| 287 |
+
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:var(--primary-color); color:#fff;">
|
| 288 |
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
| 289 |
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
|
| 290 |
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
|
| 291 |
</svg>
|
| 292 |
</a>
|
| 293 |
|
| 294 |
+
<!-- Script JavaScript -->
|
| 295 |
<script>
|
| 296 |
+
let uploadedImages = []; // Tableau pour stocker les images uploadées
|
| 297 |
+
|
| 298 |
+
// Gestion de l'upload d'images
|
| 299 |
+
const fileInput = document.getElementById('fileInput');
|
| 300 |
+
fileInput.addEventListener('change', handleImageUpload);
|
| 301 |
+
|
| 302 |
+
function handleImageUpload(event) {
|
| 303 |
+
const files = event.target.files;
|
| 304 |
+
for (let i = 0; i < files.length; i++) {
|
| 305 |
+
const file = files[i];
|
| 306 |
+
if (uploadedImages.length < 2 && file.type.startsWith('image/')) {
|
| 307 |
+
const reader = new FileReader();
|
| 308 |
+
reader.onload = (e) => {
|
| 309 |
+
const previewId = uploadedImages.length === 0 ? 'preview1' : 'preview2';
|
| 310 |
+
const previewImg = document.getElementById(previewId);
|
| 311 |
+
previewImg.style.backgroundImage = `url(${e.target.result})`;
|
| 312 |
+
uploadedImages.push({ file: file, preview: previewId });
|
| 313 |
+
updateCompareButtonState();
|
| 314 |
+
};
|
| 315 |
+
reader.readAsDataURL(file);
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
// Boutons de suppression
|
| 321 |
+
document.querySelectorAll('.delete-btn').forEach(button => {
|
| 322 |
+
button.addEventListener('click', function() {
|
| 323 |
+
const targetPreviewId = this.dataset.target;
|
| 324 |
+
const targetPreview = document.getElementById(targetPreviewId);
|
| 325 |
+
targetPreview.style.backgroundImage = '';
|
| 326 |
+
|
| 327 |
+
// Retirer l'image du tableau uploadedImages
|
| 328 |
+
uploadedImages = uploadedImages.filter(image => image.preview !== targetPreviewId);
|
| 329 |
+
|
| 330 |
+
updateCompareButtonState();
|
| 331 |
+
});
|
| 332 |
+
});
|
| 333 |
+
|
| 334 |
+
// Gestion du bouton de la caméra
|
| 335 |
+
const cameraBtn = document.getElementById('cameraBtn');
|
| 336 |
+
const video = document.getElementById('video');
|
| 337 |
+
let stream = null;
|
| 338 |
+
|
| 339 |
+
cameraBtn.addEventListener('click', async () => {
|
| 340 |
+
if (stream) {
|
| 341 |
+
// Arrêter la caméra
|
| 342 |
+
stream.getTracks().forEach(track => track.stop());
|
| 343 |
+
video.classList.add('hidden');
|
| 344 |
+
cameraBtn.innerHTML = '<i class="fas fa-video mr-2"></i>Caméra';
|
| 345 |
+
stream = null;
|
| 346 |
+
} else {
|
| 347 |
+
// Démarrer la caméra
|
| 348 |
+
try {
|
| 349 |
+
stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'user' } });
|
| 350 |
+
video.srcObject = stream;
|
| 351 |
+
video.classList.remove('hidden');
|
| 352 |
+
cameraBtn.innerHTML = '<i class="fas fa-times mr-2"></i>Arrêter';
|
| 353 |
+
} catch (err) {
|
| 354 |
+
console.error('Erreur lors de l\'accès à la caméra:', err);
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
});
|
| 358 |
+
|
| 359 |
+
// Capture d'image depuis la caméra
|
| 360 |
+
video.addEventListener('click', () => {
|
| 361 |
+
if (stream && uploadedImages.length < 2) {
|
| 362 |
+
const canvas = document.createElement('canvas');
|
| 363 |
+
canvas.width = video.videoWidth;
|
| 364 |
+
canvas.height = video.videoHeight;
|
| 365 |
+
const ctx = canvas.getContext('2d');
|
| 366 |
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
| 367 |
+
canvas.toBlob(blob => {
|
| 368 |
+
const file = new File([blob], `capture-${Date.now()}.jpg`, { type: 'image/jpeg' });
|
| 369 |
+
const previewId = uploadedImages.length === 0 ? 'preview1' : 'preview2';
|
| 370 |
+
const previewImg = document.getElementById(previewId);
|
| 371 |
+
previewImg.style.backgroundImage = `url(${URL.createObjectURL(file)})`;
|
| 372 |
+
uploadedImages.push({ file: file, preview: previewId });
|
| 373 |
+
updateCompareButtonState();
|
| 374 |
+
}, 'image/jpeg');
|
| 375 |
+
}
|
| 376 |
+
});
|
| 377 |
+
|
| 378 |
+
// Gestion du bouton de comparaison
|
| 379 |
+
const compareBtn = document.getElementById('compareBtn');
|
| 380 |
+
compareBtn.addEventListener('click', () => {
|
| 381 |
+
if (uploadedImages.length === 2) {
|
| 382 |
+
showLoading();
|
| 383 |
+
const formData = new FormData();
|
| 384 |
+
formData.append('file1', uploadedImages[0].file);
|
| 385 |
+
formData.append('file2', uploadedImages[1].file);
|
| 386 |
+
|
| 387 |
+
fetch('/compare', {
|
| 388 |
+
method: 'POST',
|
| 389 |
+
body: formData
|
| 390 |
+
})
|
| 391 |
+
.then(response => response.json())
|
| 392 |
+
.then(data => {
|
| 393 |
+
showResults(data);
|
| 394 |
+
})
|
| 395 |
+
.catch(error => {
|
| 396 |
+
console.error('Erreur lors de la comparaison:', error);
|
| 397 |
+
showError(error);
|
| 398 |
+
})
|
| 399 |
+
.finally(() => {
|
| 400 |
+
hideLoading();
|
| 401 |
+
});
|
| 402 |
+
}
|
| 403 |
+
});
|
| 404 |
+
|
| 405 |
+
function updateCompareButtonState() {
|
| 406 |
+
compareBtn.classList.toggle('hidden', uploadedImages.length < 2);
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
// Affichage des résultats
|
| 410 |
function showResults(data) {
|
| 411 |
const resultsDiv = document.getElementById('results');
|
| 412 |
resultsDiv.classList.remove('show');
|
|
|
|
| 421 |
${data.verified ? 'Visages identiques' : 'Visages différents'}
|
| 422 |
</h3>
|
| 423 |
<div class="space-y-2">
|
| 424 |
+
<p class="comparison-result ${data.verified ? 'positive' : 'negative'}">
|
| 425 |
+
Similarité: <span class="font-semibold">${data.similarity}%</span>
|
| 426 |
+
</p>
|
| 427 |
+
<div class="progress-bar">
|
| 428 |
+
<div class="progress-bar-fill" style="width: ${data.similarity}%; --progress-value: ${data.similarity};" data-progress="${data.similarity}"></div>
|
| 429 |
</div>
|
| 430 |
</div>
|
| 431 |
</div>
|
| 432 |
`;
|
| 433 |
resultsDiv.classList.add('show');
|
| 434 |
+
// Animer la barre de progression après un court délai
|
| 435 |
+
setTimeout(() => {
|
| 436 |
+
const progressBarFill = resultsDiv.querySelector('.progress-bar-fill');
|
| 437 |
+
progressBarFill.style.width = `${data.similarity}%`;
|
| 438 |
+
}, 50);
|
| 439 |
}, 300);
|
| 440 |
}
|
| 441 |
|
| 442 |
+
function showError(error) {
|
| 443 |
+
const resultsDiv = document.getElementById('results');
|
| 444 |
+
resultsDiv.classList.remove('show');
|
| 445 |
+
setTimeout(() => {
|
| 446 |
+
resultsDiv.innerHTML = `
|
| 447 |
+
<div class="text-center text-red-500">
|
| 448 |
+
<i class="fas fa-exclamation-triangle text-4xl mb-3"></i>
|
| 449 |
+
<p>Erreur : ${error.message || 'Une erreur est survenue.'}</p>
|
| 450 |
+
</div>
|
| 451 |
+
`;
|
| 452 |
+
resultsDiv.classList.add('show');
|
| 453 |
+
}, 300);
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
// Fonctions pour afficher et masquer le chargement
|
| 457 |
function showLoading() {
|
| 458 |
document.querySelector('.loading-overlay').style.display = 'flex';
|
| 459 |
}
|
|
|
|
| 461 |
function hideLoading() {
|
| 462 |
document.querySelector('.loading-overlay').style.display = 'none';
|
| 463 |
}
|
|
|
|
|
|
|
| 464 |
</script>
|
| 465 |
</body>
|
| 466 |
</html>
|