Pour les résultats d'analyse, je veux des sections avec la possibilité de les dérouler. Avant déroulage je veux l'info de l'image à gauche et la masse detecté à droite, après déroulage je veux les mêmes infos mais avec un preview de l'image et son analyse visuelle - Follow Up Deployment
Browse files- README.md +7 -5
- index.html +485 -19
- prompts.txt +3 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: stpu
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,485 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Analyse d'Images</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.screen {
|
| 11 |
+
display: none;
|
| 12 |
+
opacity: 0;
|
| 13 |
+
transition: opacity 0.5s ease;
|
| 14 |
+
}
|
| 15 |
+
.screen.active {
|
| 16 |
+
display: block;
|
| 17 |
+
opacity: 1;
|
| 18 |
+
}
|
| 19 |
+
.preview-image {
|
| 20 |
+
height: 120px;
|
| 21 |
+
object-fit: cover;
|
| 22 |
+
transition: all 0.3s ease;
|
| 23 |
+
}
|
| 24 |
+
.preview-image:hover {
|
| 25 |
+
transform: scale(1.05);
|
| 26 |
+
}
|
| 27 |
+
.upload-area {
|
| 28 |
+
border: 2px dashed #cbd5e0;
|
| 29 |
+
transition: all 0.3s ease;
|
| 30 |
+
}
|
| 31 |
+
.upload-area:hover, .upload-area.dragover {
|
| 32 |
+
border-color: #4f46e5;
|
| 33 |
+
background-color: #f8fafc;
|
| 34 |
+
}
|
| 35 |
+
.progress-ring__circle {
|
| 36 |
+
transition: stroke-dashoffset 0.3s;
|
| 37 |
+
transform: rotate(-90deg);
|
| 38 |
+
transform-origin: 50% 50%;
|
| 39 |
+
}
|
| 40 |
+
.result-card {
|
| 41 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 42 |
+
transition: all 0.3s ease;
|
| 43 |
+
border-radius: 0.5rem;
|
| 44 |
+
overflow: hidden;
|
| 45 |
+
}
|
| 46 |
+
.result-card:hover {
|
| 47 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 48 |
+
}
|
| 49 |
+
.accordion-header {
|
| 50 |
+
cursor: pointer;
|
| 51 |
+
padding: 1rem;
|
| 52 |
+
transition: background-color 0.2s;
|
| 53 |
+
}
|
| 54 |
+
.accordion-header:hover {
|
| 55 |
+
background-color: #f8fafc;
|
| 56 |
+
}
|
| 57 |
+
.accordion-content {
|
| 58 |
+
max-height: 0;
|
| 59 |
+
overflow: hidden;
|
| 60 |
+
transition: max-height 0.3s ease-out;
|
| 61 |
+
}
|
| 62 |
+
.accordion-content.expanded {
|
| 63 |
+
max-height: 1000px;
|
| 64 |
+
}
|
| 65 |
+
.analysis-compare {
|
| 66 |
+
display: grid;
|
| 67 |
+
grid-template-columns: 1fr 1fr;
|
| 68 |
+
gap: 1rem;
|
| 69 |
+
}
|
| 70 |
+
@keyframes spin {
|
| 71 |
+
0% { transform: rotate(0deg); }
|
| 72 |
+
100% { transform: rotate(360deg); }
|
| 73 |
+
}
|
| 74 |
+
.animate-spin-slow {
|
| 75 |
+
animation: spin 3s linear infinite;
|
| 76 |
+
}
|
| 77 |
+
</style>
|
| 78 |
+
</head>
|
| 79 |
+
<body class="bg-gray-50 min-h-screen font-sans">
|
| 80 |
+
<div class="container mx-auto px-4 py-8">
|
| 81 |
+
<header class="mb-12 text-center">
|
| 82 |
+
<h1 class="text-3xl md:text-4xl font-bold text-indigo-700 mb-2">Analyse de Masse</h1>
|
| 83 |
+
<p class="text-gray-600 max-w-2xl mx-auto">Chargez vos images, lancez l'analyse et visualisez les résultats</p>
|
| 84 |
+
</header>
|
| 85 |
+
|
| 86 |
+
<!-- Écran 1: Téléversement d'images -->
|
| 87 |
+
<div id="screen1" class="screen active">
|
| 88 |
+
<div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
|
| 89 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
|
| 90 |
+
<i class="fas fa-cloud-upload-alt text-indigo-500 mr-3"></i>
|
| 91 |
+
Téléversement des Images
|
| 92 |
+
</h2>
|
| 93 |
+
|
| 94 |
+
<div id="uploadArea" class="upload-area rounded-lg p-8 text-center cursor-pointer mb-6">
|
| 95 |
+
<input type="file" id="fileInput" class="hidden" accept="image/*" multiple>
|
| 96 |
+
<div class="flex flex-col items-center justify-center">
|
| 97 |
+
<i class="fas fa-images text-5xl text-indigo-400 mb-4"></i>
|
| 98 |
+
<p class="text-lg text-gray-700 mb-2">Glissez-déposez vos images ici ou cliquez pour sélectionner</p>
|
| 99 |
+
<p class="text-sm text-gray-500">Formats supportés: JPG, PNG</p>
|
| 100 |
+
<button id="selectFilesBtn" class="mt-4 px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition">Sélectionner des fichiers</button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<div id="previewContainer" class="hidden">
|
| 105 |
+
<h3 class="text-xl font-medium text-gray-700 mb-4">Prévisualisation des images</h3>
|
| 106 |
+
<div id="previewGrid" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 mb-6"></div>
|
| 107 |
+
|
| 108 |
+
<div class="flex justify-end">
|
| 109 |
+
<button id="analyzeBtn" class="px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition flex items-center">
|
| 110 |
+
<i class="fas fa-play mr-2"></i> Lancer l'analyse
|
| 111 |
+
</button>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<!-- Écran 2: Chargement et analyse -->
|
| 118 |
+
<div id="screen2" class="screen">
|
| 119 |
+
<div class="max-w-2xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-8 text-center">
|
| 120 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-8 flex items-center justify-center">
|
| 121 |
+
<i class="fas fa-cogs text-indigo-500 mr-3"></i>
|
| 122 |
+
Analyse en cours
|
| 123 |
+
</h2>
|
| 124 |
+
|
| 125 |
+
<div class="mb-8 flex justify-center">
|
| 126 |
+
<div class="relative w-40 h-40">
|
| 127 |
+
<svg class="w-full h-full" viewBox="0 0 100 100">
|
| 128 |
+
<circle class="text-gray-200" stroke-width="8" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" />
|
| 129 |
+
<circle id="progressCircle" class="text-indigo-500 progress-ring__circle" stroke-width="8" stroke-linecap="round" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" />
|
| 130 |
+
</svg>
|
| 131 |
+
<div class="absolute inset-0 flex items-center justify-center">
|
| 132 |
+
<i class="fas fa-microscope text-4xl text-indigo-500 animate-spin-slow"></i>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
<div class="relative pt-1 mb-8">
|
| 138 |
+
<div class="flex mb-2 items-center justify-between">
|
| 139 |
+
<div>
|
| 140 |
+
<span id="progressText" class="text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-indigo-600 bg-indigo-200">
|
| 141 |
+
0%
|
| 142 |
+
</span>
|
| 143 |
+
</div>
|
| 144 |
+
<div class="text-right">
|
| 145 |
+
<span id="progressStatus" class="text-xs font-semibold inline-block text-gray-600">
|
| 146 |
+
Initialisation...
|
| 147 |
+
</span>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="overflow-hidden h-2 mb-4 text-xs flex rounded bg-indigo-200">
|
| 151 |
+
<div id="progressBar" style="width:0%" class="shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-indigo-500"></div>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<p class="text-gray-600 mb-6" id="statusMessage">Préparation de l'analyse...</p>
|
| 156 |
+
<button id="cancelBtn" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Annuler</button>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<!-- Écran 3: Résultats d'analyse -->
|
| 161 |
+
<div id="screen3" class="screen">
|
| 162 |
+
<div class="max-w-6xl mx-auto">
|
| 163 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
|
| 164 |
+
<div class="flex justify-between items-center mb-6">
|
| 165 |
+
<h2 class="text-2xl font-semibold text-gray-800 flex items-center">
|
| 166 |
+
<i class="fas fa-chart-bar text-indigo-500 mr-3"></i>
|
| 167 |
+
Résultats d'analyse
|
| 168 |
+
</h2>
|
| 169 |
+
<button id="excelExportBtn" class="px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 transition flex items-center">
|
| 170 |
+
<i class="fas fa-file-excel mr-2"></i> Exporter en Excel
|
| 171 |
+
</button>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div id="resultsContainer">
|
| 175 |
+
<!-- Les résultats seront ajoutés ici dynamiquement -->
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<div class="mt-8 flex justify-center">
|
| 179 |
+
<button id="newAnalysisBtn" class="px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition flex items-center">
|
| 180 |
+
<i class="fas fa-redo mr-2"></i> Nouvelle analyse
|
| 181 |
+
</button>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
<script>
|
| 189 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 190 |
+
// Éléments DOM
|
| 191 |
+
const screen1 = document.getElementById('screen1');
|
| 192 |
+
const screen2 = document.getElementById('screen2');
|
| 193 |
+
const screen3 = document.getElementById('screen3');
|
| 194 |
+
const fileInput = document.getElementById('fileInput');
|
| 195 |
+
const selectFilesBtn = document.getElementById('selectFilesBtn');
|
| 196 |
+
const uploadArea = document.getElementById('uploadArea');
|
| 197 |
+
const previewContainer = document.getElementById('previewContainer');
|
| 198 |
+
const previewGrid = document.getElementById('previewGrid');
|
| 199 |
+
const analyzeBtn = document.getElementById('analyzeBtn');
|
| 200 |
+
const progressText = document.getElementById('progressText');
|
| 201 |
+
const progressBar = document.getElementById('progressBar');
|
| 202 |
+
const progressCircle = document.getElementById('progressCircle');
|
| 203 |
+
const progressStatus = document.getElementById('progressStatus');
|
| 204 |
+
const statusMessage = document.getElementById('statusMessage');
|
| 205 |
+
const cancelBtn = document.getElementById('cancelBtn');
|
| 206 |
+
const excelExportBtn = document.getElementById('excelExportBtn');
|
| 207 |
+
const newAnalysisBtn = document.getElementById('newAnalysisBtn');
|
| 208 |
+
const resultsContainer = document.getElementById('resultsContainer');
|
| 209 |
+
|
| 210 |
+
// Variables
|
| 211 |
+
let uploadedFiles = [];
|
| 212 |
+
let analysisInProgress = false;
|
| 213 |
+
let analysisCanceled = false;
|
| 214 |
+
|
| 215 |
+
// Événements
|
| 216 |
+
selectFilesBtn.addEventListener('click', () => fileInput.click());
|
| 217 |
+
|
| 218 |
+
uploadArea.addEventListener('click', () => fileInput.click());
|
| 219 |
+
|
| 220 |
+
uploadArea.addEventListener('dragover', (e) => {
|
| 221 |
+
e.preventDefault();
|
| 222 |
+
uploadArea.classList.add('dragover');
|
| 223 |
+
});
|
| 224 |
+
|
| 225 |
+
uploadArea.addEventListener('dragleave', () => {
|
| 226 |
+
uploadArea.classList.remove('dragover');
|
| 227 |
+
});
|
| 228 |
+
|
| 229 |
+
uploadArea.addEventListener('drop', (e) => {
|
| 230 |
+
e.preventDefault();
|
| 231 |
+
uploadArea.classList.remove('dragover');
|
| 232 |
+
handleFiles(e.dataTransfer.files);
|
| 233 |
+
});
|
| 234 |
+
|
| 235 |
+
fileInput.addEventListener('change', () => {
|
| 236 |
+
if (fileInput.files.length > 0) {
|
| 237 |
+
handleFiles(fileInput.files);
|
| 238 |
+
}
|
| 239 |
+
});
|
| 240 |
+
|
| 241 |
+
analyzeBtn.addEventListener('click', startAnalysis);
|
| 242 |
+
|
| 243 |
+
cancelBtn.addEventListener('click', cancelAnalysis);
|
| 244 |
+
|
| 245 |
+
excelExportBtn.addEventListener('click', exportToExcel);
|
| 246 |
+
|
| 247 |
+
newAnalysisBtn.addEventListener('click', resetApp);
|
| 248 |
+
|
| 249 |
+
// Fonctions
|
| 250 |
+
function handleFiles(files) {
|
| 251 |
+
uploadedFiles = Array.from(files)
|
| 252 |
+
.filter(file => file.type.startsWith('image/'))
|
| 253 |
+
.slice(0, 20); // Limite à 20 fichiers pour cet exemple
|
| 254 |
+
|
| 255 |
+
if (uploadedFiles.length === 0) {
|
| 256 |
+
alert('Veuillez sélectionner des fichiers image valides (JPG, PNG).');
|
| 257 |
+
return;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
// Afficher la prévisualisation
|
| 261 |
+
previewGrid.innerHTML = '';
|
| 262 |
+
uploadedFiles.forEach((file, index) => {
|
| 263 |
+
const reader = new FileReader();
|
| 264 |
+
reader.onload = function(e) {
|
| 265 |
+
const previewCard = document.createElement('div');
|
| 266 |
+
previewCard.className = 'relative group';
|
| 267 |
+
previewCard.innerHTML = `
|
| 268 |
+
<div class="relative overflow-hidden rounded-lg">
|
| 269 |
+
<img src="${e.target.result}" alt="Prévisualisation" class="w-full preview-image rounded-lg">
|
| 270 |
+
<div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center opacity-0 group-hover:opacity-100 transition">
|
| 271 |
+
<span class="text-white font-medium">Image ${index + 1}</span>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
<div class="mt-2 text-xs text-gray-600 truncate">${file.name}</div>
|
| 275 |
+
`;
|
| 276 |
+
previewGrid.appendChild(previewCard);
|
| 277 |
+
};
|
| 278 |
+
reader.readAsDataURL(file);
|
| 279 |
+
});
|
| 280 |
+
|
| 281 |
+
previewContainer.classList.remove('hidden');
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
function showScreen(screenNumber) {
|
| 285 |
+
screen1.classList.remove('active');
|
| 286 |
+
screen2.classList.remove('active');
|
| 287 |
+
screen3.classList.remove('active');
|
| 288 |
+
|
| 289 |
+
if (screenNumber === 1) screen1.classList.add('active');
|
| 290 |
+
else if (screenNumber === 2) screen2.classList.add('active');
|
| 291 |
+
else if (screenNumber === 3) screen3.classList.add('active');
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
function startAnalysis() {
|
| 295 |
+
if (uploadedFiles.length === 0) {
|
| 296 |
+
alert('Veuillez d\'abord téléverser des images.');
|
| 297 |
+
return;
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
showScreen(2);
|
| 301 |
+
analysisInProgress = true;
|
| 302 |
+
analysisCanceled = false;
|
| 303 |
+
|
| 304 |
+
let progress = 0;
|
| 305 |
+
const statusMessages = [
|
| 306 |
+
"Préparation des images...",
|
| 307 |
+
"Détection des caractéristiques...",
|
| 308 |
+
"Analyse des contours...",
|
| 309 |
+
"Calcul des masses...",
|
| 310 |
+
"Compilation des résultats..."
|
| 311 |
+
];
|
| 312 |
+
|
| 313 |
+
const interval = setInterval(() => {
|
| 314 |
+
if (analysisCanceled) {
|
| 315 |
+
clearInterval(interval);
|
| 316 |
+
statusMessage.textContent = "Analyse annulée";
|
| 317 |
+
progressBar.style.width = '0%';
|
| 318 |
+
progressText.textContent = '0%';
|
| 319 |
+
setProgressCircle(0);
|
| 320 |
+
return;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
progress += Math.random() * 10;
|
| 324 |
+
if (progress > 100) progress = 100;
|
| 325 |
+
|
| 326 |
+
progressBar.style.width = `${progress}%`;
|
| 327 |
+
progressText.textContent = `${Math.round(progress)}%`;
|
| 328 |
+
setProgressCircle(progress);
|
| 329 |
+
|
| 330 |
+
const messageIndex = Math.min(Math.floor(progress / 20), statusMessages.length - 1);
|
| 331 |
+
progressStatus.textContent = statusMessages[messageIndex];
|
| 332 |
+
statusMessage.textContent = getStatusDetails(messageIndex);
|
| 333 |
+
|
| 334 |
+
if (progress === 100) {
|
| 335 |
+
clearInterval(interval);
|
| 336 |
+
analysisInProgress = false;
|
| 337 |
+
setTimeout(showResults, 1000);
|
| 338 |
+
}
|
| 339 |
+
}, 300);
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
function getStatusDetails(index) {
|
| 343 |
+
const details = [
|
| 344 |
+
"Préparation des images pour l'analyse...",
|
| 345 |
+
"Scan des images en cours, détection des éléments visuels...",
|
| 346 |
+
"Analyse des contours des objets détectés pour précision accrue...",
|
| 347 |
+
"Calcul des masses basé sur les caractéristiques des images...",
|
| 348 |
+
"Finalisation de l'analyse, préparation des résultats..."
|
| 349 |
+
];
|
| 350 |
+
return details[index];
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
function setProgressCircle(percent) {
|
| 354 |
+
const circumference = 2 * Math.PI * 40;
|
| 355 |
+
const offset = circumference - (percent / 100) * circumference;
|
| 356 |
+
progressCircle.style.strokeDasharray = circumference;
|
| 357 |
+
progressCircle.style.strokeDashoffset = offset;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
function cancelAnalysis() {
|
| 361 |
+
if (analysisInProgress) {
|
| 362 |
+
analysisCanceled = true;
|
| 363 |
+
cancelBtn.disabled = true;
|
| 364 |
+
cancelBtn.classList.add('opacity-50');
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
function showResults() {
|
| 369 |
+
showScreen(3);
|
| 370 |
+
resultsContainer.innerHTML = '';
|
| 371 |
+
|
| 372 |
+
uploadedFiles.forEach((file, index) => {
|
| 373 |
+
const reader = new FileReader();
|
| 374 |
+
reader.onload = function(e) {
|
| 375 |
+
// Génération aléatoire de résultats pour la démo
|
| 376 |
+
const mass = (Math.random() * 1000).toFixed(2);
|
| 377 |
+
const color = getRandomColor();
|
| 378 |
+
|
| 379 |
+
const resultCard = document.createElement('div');
|
| 380 |
+
resultCard.className = 'result-card bg-white rounded-lg overflow-hidden shadow-md mb-4';
|
| 381 |
+
resultCard.innerHTML = `
|
| 382 |
+
<div class="accordion-header flex justify-between items-center p-4 border-b border-gray-200" onclick="toggleAccordion(this)">
|
| 383 |
+
<div class="flex items-center">
|
| 384 |
+
<span class="font-medium text-gray-800 mr-2">Image ${index + 1}:</span>
|
| 385 |
+
<span class="text-gray-600 text-sm truncate max-w-xs">${file.name}</span>
|
| 386 |
+
</div>
|
| 387 |
+
<div class="flex items-center">
|
| 388 |
+
<span class="text-2xl font-bold mr-3" style="color: ${color}">${mass} g</span>
|
| 389 |
+
<i class="fas fa-chevron-down text-gray-400 transform transition-transform"></i>
|
| 390 |
+
</div>
|
| 391 |
+
</div>
|
| 392 |
+
<div class="accordion-content">
|
| 393 |
+
<div class="p-4 grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 394 |
+
<div>
|
| 395 |
+
<div class="mb-4">
|
| 396 |
+
<h4 class="text-md font-medium text-gray-700 mb-2 flex items-center">
|
| 397 |
+
<i class="fas fa-image mr-2 text-indigo-500"></i>
|
| 398 |
+
Image originale
|
| 399 |
+
</h4>
|
| 400 |
+
<img src="${e.target.result}" alt="Image ${index + 1}" class="w-full h-48 object-contain rounded border border-gray-200">
|
| 401 |
+
</div>
|
| 402 |
+
</div>
|
| 403 |
+
<div>
|
| 404 |
+
<div class="mb-4">
|
| 405 |
+
<h4 class="text-md font-medium text-gray-700 mb-2 flex items-center">
|
| 406 |
+
<i class="fas fa-search mr-2 text-indigo-500"></i>
|
| 407 |
+
Analyse visuelle
|
| 408 |
+
</h4>
|
| 409 |
+
<div class="w-full h-48 rounded border border-gray-200 flex items-center justify-center" style="background-color: ${color}20; border-color: ${color}">
|
| 410 |
+
<div class="text-center">
|
| 411 |
+
<div class="w-32 h-32 rounded-full mx-auto mb-2" style="background-color: ${color}50; border: 2px solid ${color}"></div>
|
| 412 |
+
<span class="text-sm font-medium" style="color: ${color}">Zone détectée</span>
|
| 413 |
+
</div>
|
| 414 |
+
</div>
|
| 415 |
+
</div>
|
| 416 |
+
<div class="bg-gray-50 p-3 rounded-lg">
|
| 417 |
+
<h4 class="text-md font-medium text-gray-700 mb-1 flex items-center">
|
| 418 |
+
<i class="fas fa-weight-hanging mr-2 text-indigo-500"></i>
|
| 419 |
+
Détails de masse
|
| 420 |
+
</h4>
|
| 421 |
+
<div class="flex items-center">
|
| 422 |
+
<span class="text-xl font-bold mr-2" style="color: ${color}">${mass} g</span>
|
| 423 |
+
<span class="text-sm text-gray-500">(valeur estimée)</span>
|
| 424 |
+
</div>
|
| 425 |
+
</div>
|
| 426 |
+
</div>
|
| 427 |
+
</div>
|
| 428 |
+
</div>
|
| 429 |
+
`;
|
| 430 |
+
resultsContainer.appendChild(resultCard);
|
| 431 |
+
};
|
| 432 |
+
reader.readAsDataURL(file);
|
| 433 |
+
});
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
function getRandomColor() {
|
| 437 |
+
const colors = ['#4F46E5', '#10B981', '#3B82F6', '#F59E0B', '#EF4444'];
|
| 438 |
+
return colors[Math.floor(Math.random() * colors.length)];
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
function exportToExcel() {
|
| 442 |
+
// Simulation d'export Excel
|
| 443 |
+
const exportData = uploadedFiles.map((file, index) => {
|
| 444 |
+
return {
|
| 445 |
+
'Numéro': index + 1,
|
| 446 |
+
'Nom du fichier': file.name,
|
| 447 |
+
'Masse détectée (g)': (Math.random() * 1000).toFixed(2)
|
| 448 |
+
};
|
| 449 |
+
});
|
| 450 |
+
|
| 451 |
+
// Ici, normalement on utiliserait une bibliothèque comme SheetJS pour générer un vrai fichier Excel
|
| 452 |
+
alert('Export Excel simulé. En production, cela générerait un fichier avec:\n\n' +
|
| 453 |
+
JSON.stringify(exportData, null, 2));
|
| 454 |
+
|
| 455 |
+
console.log('Données pour export Excel:', exportData);
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
// Fonction globale pour gérer l'ouverture/fermeture des accordéons
|
| 459 |
+
window.toggleAccordion = function(header) {
|
| 460 |
+
const content = header.nextElementSibling;
|
| 461 |
+
const icon = header.querySelector('i.fa-chevron-down');
|
| 462 |
+
|
| 463 |
+
if (content.classList.contains('expanded')) {
|
| 464 |
+
content.classList.remove('expanded');
|
| 465 |
+
icon.style.transform = 'rotate(0deg)';
|
| 466 |
+
} else {
|
| 467 |
+
content.classList.add('expanded');
|
| 468 |
+
icon.style.transform = 'rotate(180deg)';
|
| 469 |
+
}
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
function resetApp() {
|
| 473 |
+
uploadedFiles = [];
|
| 474 |
+
fileInput.value = '';
|
| 475 |
+
previewContainer.classList.add('hidden');
|
| 476 |
+
previewGrid.innerHTML = '';
|
| 477 |
+
showScreen(1);
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
// Initialisation du cercle de progression
|
| 481 |
+
setProgressCircle(0);
|
| 482 |
+
});
|
| 483 |
+
</script>
|
| 484 |
+
<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></body>
|
| 485 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
On reprends, je veux 3 écrans : Le premier est un écran de téléversage d'image, avec possiblité d'en téléverser plusieurs et les nommer de 1 à x selon leurs ordre de téléversage, voir leurs prévisualisations et lancer une analyse. Le deuxieme écran lui est un chargement avec une loop et une loading barre, qui correspond à l'analyse. Le troisième écran lui est l'interprétation, avec le résultat de l'analyse visuel ainsi que la masse detecté. Il faut qu'il y ai des sections par images avec l'information demandé. Il faut aussi un bouton excel afin de faire un export excel de ces données (images et résultats de masse detéctés)
|
| 2 |
+
Pour l'écran de résultats je veux qu'elle soit présenté ainsi : des barres avec possiblité de dérouler l'information : avant déroulement l'information est le numéro de l'image et son information et le poids détéctés. Lorsqu'on déroule l'information, on peut avoir un apercu de l'avant après analyse
|
| 3 |
+
Pour les résultats d'analyse, je veux des sections avec la possibilité de les dérouler. Avant déroulage je veux l'info de l'image à gauche et la masse detecté à droite, après déroulage je veux les mêmes infos mais avec un preview de l'image et son analyse visuelle
|