File size: 9,467 Bytes
d5ce766 460bd1d f9ced6f 4cd16ec f9ced6f 460bd1d f9ced6f 460bd1d dfc761c 460bd1d f9ced6f dfc761c 460bd1d f9ced6f 460bd1d f9ced6f 7631179 f9ced6f 460bd1d d5ce766 f9ced6f d5ce766 f9ced6f 4cd16ec f9ced6f 4cd16ec f9ced6f 4cd16ec f9ced6f df36903 f9ced6f 4cd16ec f9ced6f 4cd16ec df36903 d5ce766 f9ced6f 460bd1d d5ce766 dfc761c f9ced6f 460bd1d f9ced6f 460bd1d 4cd16ec dfc761c 4cd16ec 2081e73 dfc761c 4cd16ec 460bd1d dfc761c 460bd1d dfc761c 460bd1d 4cd16ec f9ced6f 4cd16ec dfc761c 460bd1d 4cd16ec f9ced6f dfc761c 4cd16ec dfc761c 4cd16ec dfc761c f9ced6f d5ce766 f9ced6f 4cd16ec f9ced6f 4cd16ec dfc761c 4cd16ec f9ced6f dfc761c d5ce766 f9ced6f 460bd1d d5ce766 7631179 |
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 |
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mariam AI - Analyse Littéraire (Images Multiples)</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Inter:wght@300;400;500;600;700&display=swap');
.custom-prose h1, .custom-prose h2, .custom-prose h3 {
font-family: 'Playfair Display', serif;
margin-top: 2em;
margin-bottom: 1em;
line-height: 1.3;
}
.custom-prose p {
margin-bottom: 1.5em;
line-height: 1.8;
}
.custom-prose ul, .custom-prose ol {
margin-top: 1em;
margin-bottom: 1em;
padding-left: 1.5em;
}
.custom-prose li {
margin-bottom: 0.5em;
}
.markdown-table table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
margin: 2em 0;
background: white;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.markdown-table th {
background: #1a365d;
color: white;
font-weight: 600;
padding: 1rem;
text-align: left;
}
.markdown-table td {
padding: 1rem;
border-bottom: 1px solid #e2e8f0;
}
.markdown-table tr:hover {
background: #f8fafc;
}
.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
width: 3rem;
height: 3rem;
border-radius: 50%;
border-left-color: #1a365d;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.fade-enter {
opacity: 0;
transform: translateY(20px);
}
.fade-enter-active {
opacity: 1;
transform: translateY(0);
transition: opacity 300ms, transform 300ms;
}
</style>
</head>
<body class="bg-gradient-to-br from-gray-50 to-gray-100 min-h-screen font-['Inter']">
<div class="max-w-4xl mx-auto p-6">
<!-- En-tête -->
<header class="text-center mb-12">
<h1 class="font-['Playfair_Display'] text-5xl font-bold text-gray-900 mb-4">Mariam AI</h1>
<p class="text-xl text-gray-600">Assistant d'Analyse Littéraire</p>
</header>
<div class="bg-white rounded-xl shadow-lg p-8">
<!-- Zone de téléchargement -->
<form id="uploadForm" class="space-y-6" enctype="multipart/form-data">
<div class="relative">
<label for="imageInput" class="block text-lg font-medium text-gray-700 mb-3">
Sélectionnez vos documents
</label>
<div class="mt-2 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-lg hover:border-blue-500 transition-colors cursor-pointer">
<div class="space-y-2 text-center">
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48" aria-hidden="true">
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<div class="text-sm text-gray-600">
<label for="imageInput" class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none">
<span>Télécharger des fichiers</span>
<input id="imageInput" name="images" type="file" class="sr-only" accept="image/*" multiple required>
</label>
</div>
<p class="text-xs text-gray-500">PNG, JPG jusqu'à 10MB</p>
</div>
</div>
</div>
<!-- Prévisualisation multiple -->
<div id="previewContainer" class="hidden">
<p class="text-gray-700 font-medium mb-3">Aperçu des documents :</p>
<div id="previewImages" class="grid grid-cols-2 gap-4">
<!-- Les images prévisualisées seront injectées ici -->
</div>
</div>
<button type="submit" class="w-full bg-blue-600 text-white rounded-lg px-4 py-3 font-semibold hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors">
Lancer l'analyse
</button>
</form>
<!-- Indicateur de chargement -->
<div id="loading" class="hidden">
<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white p-6 rounded-lg shadow-xl text-center">
<div class="spinner mx-auto mb-4"></div>
<p class="text-gray-700 font-medium">Analyse en cours...</p>
</div>
</div>
</div>
<!-- Résultats -->
<div id="result" class="hidden mt-8 space-y-8">
<!-- Navigation -->
<div class="flex space-x-4 border-b border-gray-200">
<button id="dissertationTab" class="px-4 py-2 text-sm font-medium text-blue-600 border-b-2 border-blue-600">
Dissertation
</button>
<button id="tableauTab" class="px-4 py-2 text-sm font-medium text-gray-500 hover:text-gray-700">
Tableau d'analyse
</button>
</div>
<!-- Contenu Dissertation -->
<div id="dissertationContent" class="custom-prose prose prose-lg max-w-none">
</div>
<!-- Contenu Tableau -->
<div id="tableauContent" class="hidden markdown-table prose prose-lg max-w-none">
<div class="overflow-x-auto">
<!-- Le tableau sera injecté ici via Marked -->
</div>
</div>
</div>
</div>
</div>
<script>
// Gestion de la prévisualisation de plusieurs images
const imageInput = document.getElementById('imageInput');
const previewContainer = document.getElementById('previewContainer');
const previewImages = document.getElementById('previewImages');
imageInput.addEventListener('change', function() {
const files = this.files;
previewImages.innerHTML = ""; // Réinitialiser la prévisualisation
if (files && files.length > 0) {
previewContainer.classList.remove('hidden');
Array.from(files).forEach(file => {
const reader = new FileReader();
reader.onload = function(e) {
const img = document.createElement('img');
img.src = e.target.result;
img.alt = "Aperçu du document";
img.className = "w-full max-h-60 object-contain rounded-lg";
previewImages.appendChild(img);
};
reader.readAsDataURL(file);
});
} else {
previewContainer.classList.add('hidden');
}
});
// Gestion des onglets de résultats
const dissertationTab = document.getElementById('dissertationTab');
const tableauTab = document.getElementById('tableauTab');
const dissertationContent = document.getElementById('dissertationContent');
const tableauContent = document.getElementById('tableauContent');
dissertationTab.addEventListener('click', function() {
dissertationTab.classList.add('text-blue-600', 'border-b-2', 'border-blue-600');
tableauTab.classList.remove('text-blue-600', 'border-b-2', 'border-blue-600');
dissertationContent.classList.remove('hidden');
tableauContent.classList.add('hidden');
});
tableauTab.addEventListener('click', function() {
tableauTab.classList.add('text-blue-600', 'border-b-2', 'border-blue-600');
dissertationTab.classList.remove('text-blue-600', 'border-b-2', 'border-blue-600');
tableauContent.classList.remove('hidden');
dissertationContent.classList.add('hidden');
});
// Soumission du formulaire vers l'endpoint analyze_multi
const uploadForm = document.getElementById('uploadForm');
uploadForm.addEventListener('submit', function(e) {
e.preventDefault();
document.getElementById('loading').classList.remove('hidden');
document.getElementById('result').classList.add('hidden');
const formData = new FormData(uploadForm);
fetch('/analyze_multi', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
document.getElementById('loading').classList.add('hidden');
if (data.error) {
throw new Error(data.error);
}
dissertationContent.innerHTML = marked.parse(data.dissertation);
tableauContent.querySelector('.overflow-x-auto').innerHTML = marked.parse(data.tableau);
document.getElementById('result').classList.remove('hidden');
dissertationTab.click();
document.getElementById('result').scrollIntoView({ behavior: 'smooth' });
})
.catch(error => {
document.getElementById('loading').classList.add('hidden');
alert("Une erreur est survenue : " + error.message);
});
});
// Animation douce pour les transitions
document.querySelectorAll('.fade-enter').forEach(element => {
element.classList.add('fade-enter-active');
setTimeout(() => {
element.classList.remove('fade-enter', 'fade-enter-active');
}, 300);
});
</script>
</body>
</html>
|