Spaces:
Sleeping
Sleeping
File size: 24,473 Bytes
f5f210d |
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Argus Pro - Démonstration de Reconnaissance Faciale</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
<style>
:root {
--primary-color: #2563eb; /* Bleu plus formel */
--secondary-color: #1d4ed8; /* Bleu secondaire */
--gray-dark: #1f2937;
--gray-light: #f3f4f6;
--font-sans: 'Inter', sans-serif; /* Police plus professionnelle */
}
body {
font-family: var(--font-sans);
background-color: var(--gray-light);
color: var(--gray-dark);
line-height: 1.6;
}
/* Animations */
@keyframes pulse-border {
0% { box-shadow: 0 0 0 0 rgba(var(--primary-color), 0.7); }
70% { box-shadow: 0 0 0 10px rgba(var(--primary-color), 0); }
100% { box-shadow: 0 0 0 0 rgba(var(--primary-color), 0); }
}
@keyframes spin {
100% { transform: rotate(360deg); }
}
/* Composants */
.container {
max-width: 1200px;
}
.preview-container {
position: relative;
aspect-ratio: 1;
background: white;
border-radius: 0.5rem;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.preview-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
transition: transform 0.2s ease;
}
.preview-container:hover .preview-image {
transform: scale(1.03);
}
.delete-btn {
position: absolute;
bottom: 0.5rem;
right: 0.5rem;
background-color: rgba(220, 53, 69, 0.9); /* Red-500 with opacity */
color: white;
padding: 0.4rem 0.5rem;
border-radius: 50%;
opacity: 0;
transition: opacity 0.2s ease;
cursor: pointer;
z-index: 10;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.preview-container:hover .delete-btn {
opacity: 0.9;
}
.preview-container:hover .delete-btn:hover {
background-color: rgba(220, 53, 69, 1);
opacity: 1;
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
}
.progress-ring {
animation: spin 1.5s linear infinite;
width: 60px;
height: 60px;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
transition: all 0.2s ease;
font-weight: 600;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
background-color: var(--secondary-color);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.btn-primary:active {
transform: translateY(1px);
}
.btn-secondary {
background-color: #4b5563;
color: white;
transition: all 0.2s ease;
font-weight: 600;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.btn-secondary:hover {
background-color: #374151;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.result-card {
border: 1px solid #e5e7eb;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1.5rem;
border-radius: 0.5rem;
background-color: white;
}
.result-card.show {
animation: fadeInUp 0.4s; /* Animation plus subtile */
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translate3d(0, 20px, 0);
}
to {
opacity: 1;
transform: none;
}
}
.camera-feed {
border-radius: 0.5rem;
transform: scaleX(-1);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.github-corner {
position: fixed;
top: 0;
right: 0;
width: 70px;
height: 70px;
z-index: 1001;
}
.github-corner:hover {
transform: scale(1.05);
transition: transform 0.2s ease;
}
.section-title {
font-size: 1.75rem;
font-weight: 700;
color: var(--gray-dark);
margin-bottom: 1.5rem;
display: flex;
align-items: center;
border-bottom: 2px solid var(--primary-color);
padding-bottom: 0.75rem;
}
.section-title i {
color: var(--primary-color);
margin-right: 1rem;
font-size: 1.5rem;
}
.input-hidden {
display: none;
}
.comparison-result {
font-size: 1.2rem;
margin-bottom: 0.75rem;
}
.comparison-result.positive {
color: #22c55e; /* Vert plus formel */
font-weight: 600;
}
.comparison-result.negative {
color: #ef4444; /* Rouge plus formel */
font-weight: 600;
}
.progress-bar {
height: 1rem;
background-color: #e5e7eb;
border-radius: 0.5rem;
margin-bottom: 1rem;
overflow: hidden;
}
.progress-bar-fill {
height: 100%;
background-color: var(--primary-color);
width: 0%;
transition: width 0.5s ease;
}
.project-description {
background-color: white;
padding: 2.5rem;
border-radius: 0.5rem;
margin-bottom: 2.5rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.project-description h2 {
font-size: 2.25rem;
font-weight: 800;
color: var(--gray-dark);
margin-bottom: 1.5rem;
line-height: 1.2;
}
.project-description p {
font-size: 1.1rem;
color: #4b5563;
line-height: 1.7;
}
.project-description ul {
list-style-type: disc;
margin-left: 1.5rem;
color: #4b5563;
margin-top: 1rem;
}
.project-description ul li {
margin-bottom: 0.75rem;
font-size: 1.1rem;
line-height: 1.7;
}
.project-description ul li ul{
list-style-type: circle;
}
.tech-used {
margin-top: 0.5rem;
}
/* Navigation */
.navbar {
background-color: white;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1rem 1.5rem;
}
.navbar .container {
display: flex;
align-items: center;
justify-content: space-between;
}
.navbar-brand {
display: flex;
align-items: center;
font-weight: 800;
font-size: 1.75rem;
color: var(--gray-dark);
}
.navbar-brand i {
color: var(--primary-color);
margin-right: 1rem;
font-size: 2rem;
}
.navbar-brand:hover{
color: var(--secondary-color);
transition: all 0.2s ease;
}
.navbar-links {
display: flex;
align-items: center;
}
.navbar-links a {
color: #4b5563;
font-weight: 500;
margin-left: 2rem;
transition: color 0.2s ease;
}
.navbar-links a:hover {
color: var(--primary-color);
}
.font-bold{
font-weight: 700;
}
/* Responsiveness */
@media (max-width: 768px) {
.preview-container {
margin-bottom: 1rem;
}
.project-description {
margin-bottom: 1.5rem;
padding: 1.5rem;
}
.project-description h2 {
font-size: 2rem;
}
.section-title {
font-size: 1.5rem;
}
.section-title i {
font-size: 1.25rem;
}
.navbar-brand {
font-size: 1.5rem;
}
.navbar-brand i {
font-size: 1.75rem;
}
.navbar-links a {
margin-left: 1.5rem;
}
}
</style>
</head>
<body class="bg-gray-100">
<div class="loading-overlay">
<svg class="progress-ring text-blue-500" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="20" fill="none" stroke="currentColor" stroke-width="5" stroke-dasharray="80, 200"/>
</svg>
</div>
<!-- Navigation -->
<nav class="navbar">
<div class="container mx-auto">
<a href="/" class="navbar-brand">
<i class="fas fa-brain text-blue-600"></i>
Argus Pro
</a>
<div class="navbar-links">
<a href="#" class="hover:text-blue-600">
<i class="fas fa-question-circle text-lg"></i>
<span class="hidden md:inline-block ml-1">Aide</span>
</a>
<a href="#" class="hover:text-blue-600">
<i class="fas fa-cog text-lg"></i>
<span class="hidden md:inline-block ml-1">Paramètres</span>
</a>
</div>
</div>
</nav>
<!-- Contenu principal -->
<main class="container mx-auto p-6">
<!-- Description du projet -->
<div class="project-description">
<h2 class="text-3xl font-extrabold text-gray-900 mb-4 tracking-tight">Argus Pro : Démonstration de Reconnaissance Faciale en Temps Réel</h2>
<p class="text-gray-700">
<strong class="font-bold">Argus Pro</strong> est une application web pour démontrer la reconnaissance faciale. Comparez deux visages et évaluez leur similarité en temps réel.
</p>
<p class="mt-4 text-gray-700">
Explorez cette technologie et ses applications dans la sécurité et l'authentification.
</p>
<h3 class="text-xl font-bold text-gray-800 mt-8 mb-3">Fonctionnalités Clés :</h3>
<ul class="text-gray-700">
<li>Comparaison en temps réel de deux images de visages.</li>
<li>Détection automatique des visages.</li>
<li>Évaluation quantitative de la similarité (en pourcentage).</li>
<li>Capture d'image via la caméra.</li>
<li>Interface utilisateur simple et intuitive.</li>
</ul>
<h3 class="text-xl font-bold text-gray-800 mt-8 mb-3">Technologies Employées :</h3>
<ul class="text-gray-700">
<li><strong class="font-bold">Backend :</strong> <a href="https://flask.palletsprojects.com/" target="_blank" class="text-blue-600 hover:underline">Flask</a> (Python).</li>
<li><strong class="font-bold">Reconnaissance Faciale :</strong> Algorithme de deep learning.</li>
<li><strong class="font-bold">Frontend :</strong> HTML5, CSS3 (<a href="https://tailwindcss.com/" target="_blank" class="text-blue-600 hover:underline">Tailwind CSS</a>), JavaScript.</li>
<li><strong class="font-bold">Icônes :</strong> <a href="https://fontawesome.com/" target="_blank" class="text-blue-600 hover:underline">Font Awesome</a>.</li>
<li><strong class="font-bold">Animations :</strong> <a href="https://animate.style/" target="_blank" class="text-blue-600 hover:underline">Animate.css</a>.</li>
</ul>
<p class="mt-4 text-gray-700">
Le code source est disponible sur GitHub : <a href="https://github.com/Yusufibin" target="_blank" class="text-blue-600 hover:underline">https://github.com/Yusufibin</a>.
</p>
</div>
<div class="grid md:grid-cols-2 gap-8">
<!-- Section de capture -->
<div class="bg-white rounded-lg shadow-md p-6">
<h2 class="section-title">
<i class="fas fa-camera"></i>
Capture d'Images
</h2>
<div class="space-y-4">
<div class="flex space-x-4">
<label for="fileInput" class="btn-primary text-white px-6 py-3 rounded-lg flex items-center cursor-pointer">
<i class="fas fa-upload mr-2"></i>
Importer des Images
</label>
<button id="cameraBtn" class="btn-secondary text-white px-6 py-3 rounded-lg flex items-center transition-all">
<i class="fas fa-video mr-2"></i>
Utiliser la Caméra
</button>
</div>
<input type="file" id="fileInput" class="input-hidden" accept="image/*" multiple>
<video id="video" class="camera-feed w-full hidden" autoplay muted playsinline></video>
<div class="grid grid-cols-2 gap-4">
<div class="preview-container">
<div id="preview1" class="preview-image"></div>
<button class="delete-btn" data-target="preview1" title="Supprimer">
<i class="fas fa-times"></i>
</button>
</div>
<div class="preview-container">
<div id="preview2" class="preview-image"></div>
<button class="delete-btn" data-target="preview2" title="Supprimer">
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Section des résultats -->
<div class="bg-white rounded-lg shadow-md p-6">
<h2 class="section-title">
<i class="fas fa-chart-bar"></i>
Résultats de l'Analyse
</h2>
<div id="results" class="result-card">
<div class="text-center text-gray-500">
<i class="fas fa-upload text-4xl mb-3"></i>
<p class="text-gray-600">Importez ou capturez deux images pour démarrer l'analyse.</p>
</div>
</div>
<button id="compareBtn" class="btn-primary w-full mt-6 py-3 rounded-lg text-white font-semibold hidden">
<i class="fas fa-sync-alt mr-2"></i>
Lancer la Comparaison
</button>
</div>
</div>
</main>
<!-- GitHub Corner -->
<a href="https://github.com/Yusufibin" class="github-corner" target="_blank" aria-label="Voir le code source sur GitHub">
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:var(--gray-dark); color:#fff;">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<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>
<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>
</svg>
</a>
<!-- Script JavaScript -->
<script>
let uploadedImages = [];
const fileInput = document.getElementById('fileInput');
fileInput.addEventListener('change', handleImageUpload);
function handleImageUpload(event) {
const files = event.target.files;
for (let i = 0; i < files.length; i++) {
const file = files[i];
if (uploadedImages.length < 2 && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = (e) => {
const previewId = uploadedImages.length === 0 ? 'preview1' : 'preview2';
const previewImg = document.getElementById(previewId);
previewImg.style.backgroundImage = `url(${e.target.result})`;
uploadedImages.push({ file: file, preview: previewId });
updateCompareButtonState();
};
reader.readAsDataURL(file);
}
}
}
document.querySelectorAll('.delete-btn').forEach(button => {
button.addEventListener('click', function() {
const targetPreviewId = this.dataset.target;
const targetPreview = document.getElementById(targetPreviewId);
targetPreview.style.backgroundImage = '';
uploadedImages = uploadedImages.filter(image => image.preview !== targetPreviewId);
updateCompareButtonState();
});
});
const cameraBtn = document.getElementById('cameraBtn');
const video = document.getElementById('video');
let stream = null;
cameraBtn.addEventListener('click', async () => {
if (stream) {
// Arrêter la caméra
stream.getTracks().forEach(track => track.stop());
video.classList.add('hidden');
cameraBtn.innerHTML = '<i class="fas fa-video mr-2"></i>Utiliser la Caméra';
stream = null;
} else {
// Démarrer la caméra
try {
stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'user' } });
video.srcObject = stream;
video.classList.remove('hidden');
cameraBtn.innerHTML = '<i class="fas fa-times mr-2"></i>Arrêter la caméra';
} catch (err) {
console.error('Erreur lors de l\'accès à la caméra:', err);
}
}
});
video.addEventListener('click', () => {
if (stream && uploadedImages.length < 2) {
const canvas = document.createElement('canvas');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
const ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
canvas.toBlob(blob => {
const file = new File([blob], `capture-${Date.now()}.jpg`, { type: 'image/jpeg' });
const previewId = uploadedImages.length === 0 ? 'preview1' : 'preview2';
const previewImg = document.getElementById(previewId);
previewImg.style.backgroundImage = `url(${URL.createObjectURL(file)})`;
uploadedImages.push({ file: file, preview: previewId });
updateCompareButtonState();
}, 'image/jpeg');
}
});
const compareBtn = document.getElementById('compareBtn');
compareBtn.addEventListener('click', () => {
if (uploadedImages.length === 2) {
showLoading();
const formData = new FormData();
formData.append('file1', uploadedImages[0].file);
formData.append('file2', uploadedImages[1].file);
fetch('/compare', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
showResults(data);
})
.catch(error => {
console.error('Erreur lors de la comparaison:', error);
showError(error);
})
.finally(() => {
hideLoading();
});
}
});
function updateCompareButtonState() {
compareBtn.classList.toggle('hidden', uploadedImages.length < 2);
}
function showResults(data) {
const resultsDiv = document.getElementById('results');
resultsDiv.classList.remove('show');
setTimeout(() => {
resultsDiv.innerHTML = `
<div class="text-center">
<div class="text-4xl mb-4 ${data.verified ? 'text-green-500' : 'text-red-500'}">
<i class="fas ${data.verified ? 'fa-check-circle' : 'fa-times-circle'}"></i>
</div>
<h3 class="text-xl font-bold mb-2">
${data.verified ? 'Visages identiques' : 'Visages différents'}
</h3>
<div class="space-y-2">
<p class="comparison-result ${data.verified ? 'positive' : 'negative'}">
Similarité: <span class="font-semibold">${data.similarity}%</span>
</p>
<div class="progress-bar">
<div class="progress-bar-fill" style="width: ${data.similarity}%; --progress-value: ${data.similarity};" data-progress="${data.similarity}"></div>
</div>
</div>
</div>
`;
resultsDiv.classList.add('show');
setTimeout(() => {
const progressBarFill = resultsDiv.querySelector('.progress-bar-fill');
progressBarFill.style.width = `${data.similarity}%`;
}, 50);
}, 300);
}
function showError(error) {
const resultsDiv = document.getElementById('results');
resultsDiv.classList.remove('show');
setTimeout(() => {
resultsDiv.innerHTML = `
<div class="text-center text-red-500">
<i class="fas fa-exclamation-triangle text-4xl mb-3"></i>
<p>Erreur : ${error.message || 'Une erreur est survenue.'}</p>
</div>
`;
resultsDiv.classList.add('show');
}, 300);
}
function showLoading() {
document.querySelector('.loading-overlay').style.display = 'flex';
}
function hideLoading() {
document.querySelector('.loading-overlay').style.display = 'none';
}
</script>
</body>
</html> |