Update templates/svt.html
Browse files- templates/svt.html +36 -72
templates/svt.html
CHANGED
@@ -46,7 +46,7 @@
|
|
46 |
<style>
|
47 |
/* Camouflage Background */
|
48 |
body {
|
49 |
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%235a6249' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-
|
50 |
background-size: 200px 200px; /* Ajustez la taille du motif selon vos préférences */
|
51 |
}
|
52 |
|
@@ -82,7 +82,7 @@
|
|
82 |
}
|
83 |
|
84 |
@keyframes spin {
|
85 |
-
0% { transform: rotate(0deg); }
|
86 |
100% { transform: rotate(360deg); }
|
87 |
}
|
88 |
|
@@ -225,14 +225,14 @@
|
|
225 |
<div class="card-hover bg-white rounded-xl shadow-lg p-8 slide-up">
|
226 |
<h2 class="text-2xl font-bold text-camo-green mb-6">Analyse d'image</h2>
|
227 |
<div class="border-2 border-dashed border-gray-300 rounded-lg p-8 transition-colors hover:border-primary-camo">
|
228 |
-
<form id="uploadForm" class="space-y-6">
|
229 |
<div class="text-center">
|
230 |
<i class="fas fa-satellite text-5xl text-primary-camo mb-4"></i>
|
231 |
<div class="mt-4">
|
232 |
<label class="block text-lg font-medium text-camo-brown mb-2">
|
233 |
Sélectionner une image satellite
|
234 |
</label>
|
235 |
-
<input type="file" id="fileInput"
|
236 |
class="mt-1 block w-full text-sm text-gray-500
|
237 |
file:mr-4 file:py-2 file:px-4
|
238 |
file:rounded-full file:border-0
|
@@ -259,10 +259,8 @@
|
|
259 |
<section id="results" class="opacity-0">
|
260 |
<div class="grid md:grid-cols-2 gap-8">
|
261 |
<div class="card-hover bg-white rounded-xl shadow-lg p-6 slide-up">
|
262 |
-
<h3 class="text-xl font-bold text-camo-green mb-4">
|
263 |
-
<
|
264 |
-
<!-- Les résultats seront insérés ici -->
|
265 |
-
</div>
|
266 |
</div>
|
267 |
<div class="card-hover bg-white rounded-xl shadow-lg p-6 slide-up">
|
268 |
<h3 class="text-xl font-bold text-camo-green mb-4">Description Détaillée</h3>
|
@@ -338,78 +336,44 @@
|
|
338 |
}
|
339 |
});
|
340 |
|
341 |
-
// Gestion du formulaire
|
342 |
-
document.getElementById('uploadForm').addEventListener('submit',
|
343 |
e.preventDefault();
|
344 |
|
345 |
-
const
|
346 |
const loader = document.getElementById('loader');
|
347 |
const resultsSection = document.getElementById('results');
|
348 |
-
const
|
349 |
const descriptionDiv = document.getElementById('description');
|
350 |
|
351 |
-
// Vérifier si un fichier a été sélectionné
|
352 |
-
if (!fileInput.files[0]) {
|
353 |
-
alert('Veuillez sélectionner une image.');
|
354 |
-
return;
|
355 |
-
}
|
356 |
-
|
357 |
-
// Afficher le loader
|
358 |
loader.style.display = 'block';
|
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 |
-
<span class="text-camo-brown">Végétation</span>
|
387 |
-
<div class="w-32 bg-gray-200 rounded-full h-2">
|
388 |
-
<div class="bg-primary-camo h-2 rounded-full progress-bar" style="width: 90%"></div>
|
389 |
-
</div>
|
390 |
-
</div>
|
391 |
-
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
392 |
-
<span class="text-camo-brown">Eau</span>
|
393 |
-
<div class="w-32 bg-gray-200 rounded-full h-2">
|
394 |
-
<div class="bg-primary-camo h-2 rounded-full progress-bar" style="width: 60%"></div>
|
395 |
-
</div>
|
396 |
-
</div>
|
397 |
-
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
398 |
-
<span class="text-camo-brown">Véhicules</span>
|
399 |
-
<div class="w-32 bg-gray-200 rounded-full h-2">
|
400 |
-
<div class="bg-primary-camo h-2 rounded-full progress-bar" style="width: 50%"></div>
|
401 |
-
</div>
|
402 |
-
</div>
|
403 |
-
</div>
|
404 |
-
`;
|
405 |
-
descriptionDiv.innerHTML = "<p class='text-camo-brown'>Analyse détaillée de l'image satellite. La détection a permis d'identifier plusieurs types d'objets avec une grande précision.</p>";
|
406 |
-
|
407 |
-
// Animer les barres de progression
|
408 |
-
setTimeout(() => {
|
409 |
-
document.querySelectorAll('.progress-bar').forEach(bar => {
|
410 |
-
bar.style.width = bar.parentElement.dataset.value || '75%';
|
411 |
-
});
|
412 |
-
}, 100);
|
413 |
});
|
414 |
</script>
|
415 |
</body>
|
|
|
46 |
<style>
|
47 |
/* Camouflage Background */
|
48 |
body {
|
49 |
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%235a6249' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9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E%3C/svg%3E");
|
50 |
background-size: 200px 200px; /* Ajustez la taille du motif selon vos préférences */
|
51 |
}
|
52 |
|
|
|
82 |
}
|
83 |
|
84 |
@keyframes spin {
|
85 |
+
0% { transform: rotate(0deg)' ; }
|
86 |
100% { transform: rotate(360deg); }
|
87 |
}
|
88 |
|
|
|
225 |
<div class="card-hover bg-white rounded-xl shadow-lg p-8 slide-up">
|
226 |
<h2 class="text-2xl font-bold text-camo-green mb-6">Analyse d'image</h2>
|
227 |
<div class="border-2 border-dashed border-gray-300 rounded-lg p-8 transition-colors hover:border-primary-camo">
|
228 |
+
<form id="uploadForm" class="space-y-6" action="/analyze" method="POST" enctype="multipart/form-data">
|
229 |
<div class="text-center">
|
230 |
<i class="fas fa-satellite text-5xl text-primary-camo mb-4"></i>
|
231 |
<div class="mt-4">
|
232 |
<label class="block text-lg font-medium text-camo-brown mb-2">
|
233 |
Sélectionner une image satellite
|
234 |
</label>
|
235 |
+
<input type="file" name="file" id="fileInput"
|
236 |
class="mt-1 block w-full text-sm text-gray-500
|
237 |
file:mr-4 file:py-2 file:px-4
|
238 |
file:rounded-full file:border-0
|
|
|
259 |
<section id="results" class="opacity-0">
|
260 |
<div class="grid md:grid-cols-2 gap-8">
|
261 |
<div class="card-hover bg-white rounded-xl shadow-lg p-6 slide-up">
|
262 |
+
<h3 class="text-xl font-bold text-camo-green mb-4">Image traitée</h3>
|
263 |
+
<img id="processedImage" src="" alt="Image traitée" class="w-full h-auto rounded-lg">
|
|
|
|
|
264 |
</div>
|
265 |
<div class="card-hover bg-white rounded-xl shadow-lg p-6 slide-up">
|
266 |
<h3 class="text-xl font-bold text-camo-green mb-4">Description Détaillée</h3>
|
|
|
336 |
}
|
337 |
});
|
338 |
|
339 |
+
// Gestion du formulaire avec Fetch API
|
340 |
+
document.getElementById('uploadForm').addEventListener('submit', function(e) {
|
341 |
e.preventDefault();
|
342 |
|
343 |
+
const formData = new FormData(this);
|
344 |
const loader = document.getElementById('loader');
|
345 |
const resultsSection = document.getElementById('results');
|
346 |
+
const processedImage = document.getElementById('processedImage');
|
347 |
const descriptionDiv = document.getElementById('description');
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
loader.style.display = 'block';
|
350 |
|
351 |
+
fetch('/analyze', {
|
352 |
+
method: 'POST',
|
353 |
+
body: formData
|
354 |
+
})
|
355 |
+
.then(response => {
|
356 |
+
if (!response.ok) {
|
357 |
+
throw new Error('Network response was not ok');
|
358 |
+
}
|
359 |
+
return response.json();
|
360 |
+
})
|
361 |
+
.then(data => {
|
362 |
+
loader.style.display = 'none';
|
363 |
+
resultsSection.classList.add('fade-in');
|
364 |
+
resultsSection.style.opacity = 1;
|
365 |
+
|
366 |
+
// Mettre à jour l'image traitée
|
367 |
+
processedImage.src = data.image_path;
|
368 |
+
|
369 |
+
// Mettre à jour la description
|
370 |
+
descriptionDiv.innerHTML = data.description;
|
371 |
+
})
|
372 |
+
.catch(error => {
|
373 |
+
console.error('Erreur lors de la requête fetch:', error);
|
374 |
+
loader.style.display = 'none';
|
375 |
+
alert('Une erreur est survenue lors de l\'analyse de l\'image.');
|
376 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
});
|
378 |
</script>
|
379 |
</body>
|