Download index.html from sephi22/stpu1: direct link, hf CLI and curl.
- Browser
- Download file 25.7 kB
-
https://huggingface.co/spaces/sephi22/stpu1/resolve/main/index.html
- Command line
-
hf download hf://spaces/sephi22/stpu1/index.html
-
curl -L -o index.html https://huggingface.co/spaces/sephi22/stpu1/resolve/main/index.html
25.7 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Analyse d'Images</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .screen { | |
| display: none; | |
| opacity: 0; | |
| transition: opacity 0.5s ease; | |
| } | |
| .screen.active { | |
| display: block; | |
| opacity: 1; | |
| } | |
| .preview-image { | |
| height: 120px; | |
| object-fit: cover; | |
| transition: all 0.3s ease; | |
| } | |
| .preview-image:hover { | |
| transform: scale(1.05); | |
| } | |
| .upload-area { | |
| border: 2px dashed #cbd5e0; | |
| transition: all 0.3s ease; | |
| } | |
| .upload-area:hover, .upload-area.dragover { | |
| border-color: #4f46e5; | |
| background-color: #f8fafc; | |
| } | |
| .progress-ring__circle { | |
| transition: stroke-dashoffset 0.3s; | |
| transform: rotate(-90deg); | |
| transform-origin: 50% 50%; | |
| } | |
| .result-card { | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); | |
| transition: all 0.3s ease; | |
| border-radius: 0.5rem; | |
| overflow: hidden; | |
| } | |
| .result-card:hover { | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
| } | |
| .accordion-header { | |
| cursor: pointer; | |
| padding: 1rem; | |
| transition: background-color 0.2s; | |
| } | |
| .accordion-header:hover { | |
| background-color: #f8fafc; | |
| } | |
| .accordion-content { | |
| max-height: 0; | |
| overflow: hidden; | |
| transition: max-height 0.3s ease-out; | |
| } | |
| .accordion-content.expanded { | |
| max-height: 1000px; | |
| } | |
| .analysis-compare { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 1rem; | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| .animate-spin-slow { | |
| animation: spin 3s linear infinite; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen font-sans"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <header class="mb-12 text-center"> | |
| <h1 class="text-3xl md:text-4xl font-bold text-[#00677f] mb-2">Analyse de Masse</h1> | |
| <p class="text-gray-600 max-w-2xl mx-auto">Chargez vos images, lancez l'analyse et visualisez les résultats</p> | |
| </header> | |
| <!-- Écran 1: Téléversement d'images --> | |
| <div id="screen1" class="screen active"> | |
| <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8"> | |
| <h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center"> | |
| <i class="fas fa-cloud-upload-alt text-indigo-500 mr-3"></i> | |
| Téléversement des Images | |
| </h2> | |
| <div id="uploadArea" class="upload-area rounded-lg p-8 text-center cursor-pointer mb-6"> | |
| <input type="file" id="fileInput" class="hidden" accept="image/*" multiple> | |
| <div class="flex flex-col items-center justify-center"> | |
| <i class="fas fa-images text-5xl text-indigo-400 mb-4"></i> | |
| <p class="text-lg text-gray-700 mb-2">Glissez-déposez vos images ici ou cliquez pour sélectionner</p> | |
| <p class="text-sm text-gray-500">Formats supportés: JPG, PNG</p> | |
| <button id="selectFilesBtn" class="mt-4 px-6 py-2 bg-[#00677f] text-white rounded-md hover:bg-[#005266] transition">Sélectionner des fichiers</button> | |
| </div> | |
| </div> | |
| <div id="previewContainer" class="hidden"> | |
| <h3 class="text-xl font-medium text-gray-700 mb-4">Prévisualisation des images</h3> | |
| <div id="previewGrid" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 mb-6"></div> | |
| <div class="flex justify-end"> | |
| <button id="analyzeBtn" class="px-6 py-2 bg-[#ffe600] text-black rounded-md hover:bg-[#e6cc00] transition flex items-center"> | |
| <i class="fas fa-play mr-2"></i> Lancer l'analyse | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Écran 2: Chargement et analyse --> | |
| <div id="screen2" class="screen"> | |
| <div class="max-w-2xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-8 text-center"> | |
| <h2 class="text-2xl font-semibold text-gray-800 mb-8 flex items-center justify-center"> | |
| <i class="fas fa-cogs text-indigo-500 mr-3"></i> | |
| Analyse en cours | |
| </h2> | |
| <div class="mb-8 flex justify-center"> | |
| <div class="relative w-40 h-40"> | |
| <svg class="w-full h-full" viewBox="0 0 100 100"> | |
| <circle class="text-gray-200" stroke-width="8" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" /> | |
| <circle id="progressCircle" class="text-[#ffe600] progress-ring__circle" stroke-width="8" stroke-linecap="round" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" /> | |
| </svg> | |
| <div class="absolute inset-0 flex items-center justify-center"> | |
| <i class="fas fa-microscope text-4xl text-indigo-500 animate-spin-slow"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="relative pt-1 mb-8"> | |
| <div class="flex mb-2 items-center justify-between"> | |
| <div> | |
| <span id="progressText" class="text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-indigo-600 bg-indigo-200"> | |
| 0% | |
| </span> | |
| </div> | |
| <div class="text-right"> | |
| <span id="progressStatus" class="text-xs font-semibold inline-block text-gray-600"> | |
| Initialisation... | |
| </span> | |
| </div> | |
| </div> | |
| <div class="overflow-hidden h-2 mb-4 text-xs flex rounded bg-[#ffe600]20"> | |
| <div id="progressBar" style="width:0%" class="shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-[#ffe600]"></div> | |
| </div> | |
| </div> | |
| <p class="text-gray-600 mb-6" id="statusMessage">Préparation de l'analyse...</p> | |
| <button id="cancelBtn" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Annuler</button> | |
| </div> | |
| </div> | |
| <!-- Écran 3: Résultats d'analyse --> | |
| <div id="screen3" class="screen"> | |
| <div class="max-w-6xl mx-auto"> | |
| <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-2xl font-semibold text-gray-800 flex items-center"> | |
| <i class="fas fa-chart-bar text-[#00677f] mr-3"></i> | |
| Résultats d'analyse | |
| </h2> | |
| <button id="excelExportBtn" class="px-4 py-2 bg-[#217346] text-white rounded-md hover:bg-[#1a5d38] transition flex items-center"> | |
| <i class="fas fa-file-excel mr-2"></i> Exporter en Excel | |
| </button> | |
| </div> | |
| <div id="resultsContainer"> | |
| <!-- Les résultats seront ajoutés ici dynamiquement --> | |
| </div> | |
| <div class="mt-8 flex justify-center"> | |
| <button id="newAnalysisBtn" class="px-6 py-2 bg-[#00677f] text-white rounded-md hover:bg-[#005266] transition flex items-center"> | |
| <i class="fas fa-redo mr-2"></i> Nouvelle analyse | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Éléments DOM | |
| const screen1 = document.getElementById('screen1'); | |
| const screen2 = document.getElementById('screen2'); | |
| const screen3 = document.getElementById('screen3'); | |
| const fileInput = document.getElementById('fileInput'); | |
| const selectFilesBtn = document.getElementById('selectFilesBtn'); | |
| const uploadArea = document.getElementById('uploadArea'); | |
| const previewContainer = document.getElementById('previewContainer'); | |
| const previewGrid = document.getElementById('previewGrid'); | |
| const analyzeBtn = document.getElementById('analyzeBtn'); | |
| const progressText = document.getElementById('progressText'); | |
| const progressBar = document.getElementById('progressBar'); | |
| const progressCircle = document.getElementById('progressCircle'); | |
| const progressStatus = document.getElementById('progressStatus'); | |
| const statusMessage = document.getElementById('statusMessage'); | |
| const cancelBtn = document.getElementById('cancelBtn'); | |
| const excelExportBtn = document.getElementById('excelExportBtn'); | |
| const newAnalysisBtn = document.getElementById('newAnalysisBtn'); | |
| const resultsContainer = document.getElementById('resultsContainer'); | |
| // Variables | |
| let uploadedFiles = []; | |
| let analysisInProgress = false; | |
| let analysisCanceled = false; | |
| // Événements | |
| selectFilesBtn.addEventListener('click', () => fileInput.click()); | |
| uploadArea.addEventListener('click', () => fileInput.click()); | |
| uploadArea.addEventListener('dragover', (e) => { | |
| e.preventDefault(); | |
| uploadArea.classList.add('dragover'); | |
| }); | |
| uploadArea.addEventListener('dragleave', () => { | |
| uploadArea.classList.remove('dragover'); | |
| }); | |
| uploadArea.addEventListener('drop', (e) => { | |
| e.preventDefault(); | |
| uploadArea.classList.remove('dragover'); | |
| handleFiles(e.dataTransfer.files); | |
| }); | |
| fileInput.addEventListener('change', () => { | |
| if (fileInput.files.length > 0) { | |
| handleFiles(fileInput.files); | |
| } | |
| }); | |
| analyzeBtn.addEventListener('click', startAnalysis); | |
| cancelBtn.addEventListener('click', cancelAnalysis); | |
| excelExportBtn.addEventListener('click', exportToExcel); | |
| newAnalysisBtn.addEventListener('click', resetApp); | |
| // Fonctions | |
| function handleFiles(files) { | |
| uploadedFiles = Array.from(files) | |
| .filter(file => file.type.startsWith('image/')) | |
| .slice(0, 20); // Limite à 20 fichiers pour cet exemple | |
| if (uploadedFiles.length === 0) { | |
| alert('Veuillez sélectionner des fichiers image valides (JPG, PNG).'); | |
| return; | |
| } | |
| // Afficher la prévisualisation | |
| previewGrid.innerHTML = ''; | |
| uploadedFiles.forEach((file, index) => { | |
| const reader = new FileReader(); | |
| reader.onload = function(e) { | |
| const previewCard = document.createElement('div'); | |
| previewCard.className = 'relative group'; | |
| previewCard.innerHTML = ` | |
| <div class="relative overflow-hidden rounded-lg"> | |
| <img src="${e.target.result}" alt="Prévisualisation" class="w-full preview-image rounded-lg"> | |
| <div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center opacity-0 group-hover:opacity-100 transition"> | |
| <span class="text-white font-medium">Image ${index + 1}</span> | |
| </div> | |
| </div> | |
| <div class="mt-2 text-xs text-gray-600 truncate">${file.name}</div> | |
| `; | |
| previewGrid.appendChild(previewCard); | |
| }; | |
| reader.readAsDataURL(file); | |
| }); | |
| previewContainer.classList.remove('hidden'); | |
| } | |
| function showScreen(screenNumber) { | |
| screen1.classList.remove('active'); | |
| screen2.classList.remove('active'); | |
| screen3.classList.remove('active'); | |
| if (screenNumber === 1) screen1.classList.add('active'); | |
| else if (screenNumber === 2) screen2.classList.add('active'); | |
| else if (screenNumber === 3) screen3.classList.add('active'); | |
| } | |
| function startAnalysis() { | |
| if (uploadedFiles.length === 0) { | |
| alert('Veuillez d\'abord téléverser des images.'); | |
| return; | |
| } | |
| showScreen(2); | |
| analysisInProgress = true; | |
| analysisCanceled = false; | |
| let progress = 0; | |
| const statusMessages = [ | |
| "Préparation des images...", | |
| "Détection des caractéristiques...", | |
| "Analyse des contours...", | |
| "Calcul des masses...", | |
| "Compilation des résultats..." | |
| ]; | |
| const interval = setInterval(() => { | |
| if (analysisCanceled) { | |
| clearInterval(interval); | |
| statusMessage.textContent = "Analyse annulée"; | |
| progressBar.style.width = '0%'; | |
| progressText.textContent = '0%'; | |
| setProgressCircle(0); | |
| return; | |
| } | |
| progress += Math.random() * 10; | |
| if (progress > 100) progress = 100; | |
| progressBar.style.width = `${progress}%`; | |
| progressText.textContent = `${Math.round(progress)}%`; | |
| setProgressCircle(progress); | |
| const messageIndex = Math.min(Math.floor(progress / 20), statusMessages.length - 1); | |
| progressStatus.textContent = statusMessages[messageIndex]; | |
| statusMessage.textContent = getStatusDetails(messageIndex); | |
| if (progress === 100) { | |
| clearInterval(interval); | |
| analysisInProgress = false; | |
| setTimeout(showResults, 1000); | |
| } | |
| }, 300); | |
| } | |
| function getStatusDetails(index) { | |
| const details = [ | |
| "Préparation des images pour l'analyse...", | |
| "Scan des images en cours, détection des éléments visuels...", | |
| "Analyse des contours des objets détectés pour précision accrue...", | |
| "Calcul des masses basé sur les caractéristiques des images...", | |
| "Finalisation de l'analyse, préparation des résultats..." | |
| ]; | |
| return details[index]; | |
| } | |
| function setProgressCircle(percent) { | |
| const circumference = 2 * Math.PI * 40; | |
| const offset = circumference - (percent / 100) * circumference; | |
| progressCircle.style.strokeDasharray = circumference; | |
| progressCircle.style.strokeDashoffset = offset; | |
| } | |
| function cancelAnalysis() { | |
| if (analysisInProgress) { | |
| analysisCanceled = true; | |
| cancelBtn.disabled = true; | |
| cancelBtn.classList.add('opacity-50'); | |
| } | |
| } | |
| function showResults() { | |
| showScreen(3); | |
| resultsContainer.innerHTML = ''; | |
| uploadedFiles.forEach((file, index) => { | |
| const reader = new FileReader(); | |
| reader.onload = function(e) { | |
| // Génération aléatoire de résultats pour la démo | |
| const mass = (Math.random() * 1000).toFixed(2); | |
| const color = getRandomColor(); | |
| const resultCard = document.createElement('div'); | |
| resultCard.className = 'result-card bg-white rounded-lg overflow-hidden shadow-md mb-4'; | |
| resultCard.innerHTML = ` | |
| <div class="accordion-header flex justify-between items-center p-4 border-b border-gray-200" onclick="toggleAccordion(this)"> | |
| <div class="flex items-center"> | |
| <span class="font-medium text-gray-800 mr-2">Image ${index + 1}:</span> | |
| <span class="text-gray-600 text-sm truncate max-w-xs">${file.name}</span> | |
| </div> | |
| <div class="flex items-center"> | |
| <span class="text-2xl font-bold mr-3" style="color: ${color}">${mass} g</span> | |
| <i class="fas fa-chevron-down text-gray-400 transform transition-transform"></i> | |
| </div> | |
| </div> | |
| <div class="accordion-content"> | |
| <div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <div class="mb-4"> | |
| <h4 class="text-md font-medium text-gray-700 mb-2 flex items-center"> | |
| <i class="fas fa-image mr-2 text-indigo-500"></i> | |
| Image originale | |
| </h4> | |
| <img src="${e.target.result}" alt="Image ${index + 1}" class="w-full h-48 object-contain rounded border border-gray-200"> | |
| </div> | |
| </div> | |
| <div> | |
| <div class="mb-4"> | |
| <h4 class="text-md font-medium text-gray-700 mb-2 flex items-center"> | |
| <i class="fas fa-search mr-2 text-indigo-500"></i> | |
| Analyse visuelle | |
| </h4> | |
| <div class="w-full h-48 rounded border border-gray-200 flex items-center justify-center" style="background-color: ${color}20; border-color: ${color}"> | |
| <div class="text-center"> | |
| <div class="w-32 h-32 rounded-full mx-auto mb-2" style="background-color: ${color}50; border: 2px solid ${color}"></div> | |
| <span class="text-sm font-medium" style="color: ${color}">Zone détectée</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-50 p-3 rounded-lg"> | |
| <h4 class="text-md font-medium text-gray-700 mb-1 flex items-center"> | |
| <i class="fas fa-weight-hanging mr-2 text-indigo-500"></i> | |
| Détails de masse | |
| </h4> | |
| <div class="flex items-center"> | |
| <span class="text-xl font-bold mr-2" style="color: ${color}">${mass} g</span> | |
| <span class="text-sm text-gray-500">(valeur estimée)</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| resultsContainer.appendChild(resultCard); | |
| }; | |
| reader.readAsDataURL(file); | |
| }); | |
| } | |
| function getRandomColor() { | |
| const colors = [ | |
| '#00677f', // Secondary color | |
| '#ffe600', // Primary color | |
| '#000000', // Black | |
| '#333333', // Dark gray | |
| '#666666' // Medium gray | |
| ]; | |
| return colors[Math.floor(Math.random() * colors.length)]; | |
| } | |
| function exportToExcel() { | |
| // Simulation d'export Excel | |
| const exportData = uploadedFiles.map((file, index) => { | |
| return { | |
| 'Numéro': index + 1, | |
| 'Nom du fichier': file.name, | |
| 'Masse détectée (g)': (Math.random() * 1000).toFixed(2) | |
| }; | |
| }); | |
| // Ici, normalement on utiliserait une bibliothèque comme SheetJS pour générer un vrai fichier Excel | |
| alert('Export Excel simulé. En production, cela générerait un fichier avec:\n\n' + | |
| JSON.stringify(exportData, null, 2)); | |
| console.log('Données pour export Excel:', exportData); | |
| } | |
| // Fonction globale pour gérer l'ouverture/fermeture des accordéons | |
| window.toggleAccordion = function(header) { | |
| const content = header.nextElementSibling; | |
| const icon = header.querySelector('i.fa-chevron-down'); | |
| if (content.classList.contains('expanded')) { | |
| content.classList.remove('expanded'); | |
| icon.style.transform = 'rotate(0deg)'; | |
| } else { | |
| content.classList.add('expanded'); | |
| icon.style.transform = 'rotate(180deg)'; | |
| } | |
| } | |
| function resetApp() { | |
| uploadedFiles = []; | |
| fileInput.value = ''; | |
| previewContainer.classList.add('hidden'); | |
| previewGrid.innerHTML = ''; | |
| showScreen(1); | |
| } | |
| // Initialisation du cercle de progression | |
| setProgressCircle(0); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=sephi22/stpu" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://deepsite.hf.co/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=sephi22/stpu1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |