Docfile commited on
Commit
189dc11
·
verified ·
1 Parent(s): e4b56f5

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +92 -42
templates/index.html CHANGED
@@ -12,18 +12,45 @@
12
  extend: {
13
  colors: {
14
  primary: '#4CAF50',
15
- 'primary-dark': '#3e8e41',
16
  secondary: '#2D3748',
17
  accent: '#F6AD55'
18
  },
19
  fontFamily: {
20
  sans: ['Inter', 'sans-serif']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
  }
23
  }
24
  }
25
  </script>
26
  <style>
 
 
 
 
 
27
  .markdown-content {
28
  width: 100%;
29
  overflow-wrap: break-word;
@@ -37,6 +64,7 @@
37
  border-radius: 0.5rem;
38
  margin: 1rem 0;
39
  overflow-x: auto;
 
40
  }
41
  .markdown-content code {
42
  background-color: #edf2f7;
@@ -44,13 +72,11 @@
44
  border-radius: 0.25rem;
45
  font-family: ui-monospace, monospace;
46
  }
47
- /* Amélioration pour les paragraphes et espacements */
48
  .markdown-content p {
49
  margin-bottom: 1rem;
50
  line-height: 1.6;
51
  white-space: pre-line;
52
  }
53
- /* Styles pour les titres */
54
  .markdown-content h1 {
55
  font-size: 1.8rem;
56
  font-weight: bold;
@@ -71,7 +97,6 @@
71
  margin-top: 1rem;
72
  margin-bottom: 0.5rem;
73
  }
74
- /* Styles pour les listes */
75
  .markdown-content ul, .markdown-content ol {
76
  margin-left: 1.5rem;
77
  margin-bottom: 1rem;
@@ -79,7 +104,6 @@
79
  .markdown-content li {
80
  margin-bottom: 0.5rem;
81
  }
82
- /* Styles pour les blockquotes */
83
  .markdown-content blockquote {
84
  border-left: 4px solid #e2e8f0;
85
  padding-left: 1rem;
@@ -89,7 +113,6 @@
89
  font-style: italic;
90
  color: #4a5568;
91
  }
92
- /* Styles pour les séparateurs horizontaux */
93
  .markdown-content hr {
94
  margin: 1.5rem 0;
95
  border: 0;
@@ -102,20 +125,29 @@
102
  .animate-fade-in {
103
  animation: fadeIn 1s ease-out;
104
  }
105
- /* Ajout d'une ombre plus marquée pour les cartes */
106
  .card {
107
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
 
 
 
108
  }
109
  </style>
110
  </head>
111
- <body class="bg-gradient-to-br from-gray-100 to-gray-300 min-h-screen font-sans">
112
  <div class="container mx-auto px-4 py-12 max-w-6xl">
113
  <!-- Header -->
114
  <header class="text-center mb-16 animate-fade-in">
115
- <h1 class="text-5xl font-bold text-primary mb-4 drop-shadow-lg">
116
  ✨ Mariam Anglais ✨
117
  </h1>
118
- <p class="text-secondary text-lg">
119
  Téléchargez vos images, choisissez votre type d'analyse et laissez la magie opérer.
120
  </p>
121
  </header>
@@ -123,7 +155,7 @@
123
  <!-- Main Content -->
124
  <div class="grid md:grid-cols-2 gap-12">
125
  <!-- Upload Section -->
126
- <div class="bg-white rounded-xl card p-8">
127
  <h2 class="text-2xl font-semibold text-primary mb-6 flex items-center gap-2">
128
  <svg class="h-8 w-8 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
129
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
@@ -131,7 +163,7 @@
131
  Téléchargement d'images
132
  </h2>
133
  <div
134
- class="upload-zone border-2 border-dashed border-primary rounded-lg p-10 text-center cursor-pointer hover:bg-gray-50 transition-colors"
135
  onclick="document.getElementById('image-upload').click()">
136
  <input type="file" id="image-upload" multiple accept="image/*" class="hidden" />
137
  <p class="text-gray-600 font-medium">Cliquez ou glissez vos images ici</p>
@@ -140,7 +172,7 @@
140
  </div>
141
 
142
  <!-- Analysis Type Section -->
143
- <div class="bg-white rounded-xl card p-8">
144
  <h2 class="text-2xl font-semibold text-primary mb-6 flex items-center gap-2">
145
  <svg class="h-8 w-8 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
146
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2a4 4 0 00-4-4H3"></path>
@@ -149,8 +181,7 @@
149
  Choix du type d'analyse
150
  </h2>
151
  <div class="space-y-6">
152
- <!-- Option Analyse de Texte -->
153
- <label class="flex flex-col p-5 rounded-lg border border-gray-200 cursor-pointer hover:bg-gray-50 transition-colors">
154
  <div class="flex items-center">
155
  <input type="radio" name="analysis_type" value="text" class="h-5 w-5 text-primary" />
156
  <span class="ml-3 text-lg font-medium text-secondary">🔍 Analyse de Texte</span>
@@ -159,8 +190,7 @@
159
  Analyse de texte détaillée comprenant INTRODUCTION, SUMMARY, COMMENTARY et EVALUATION.
160
  </p>
161
  </label>
162
- <!-- Option Document iconographique -->
163
- <label class="flex flex-col p-5 rounded-lg border border-gray-200 cursor-pointer hover:bg-gray-50 transition-colors">
164
  <div class="flex items-center">
165
  <input type="radio" name="analysis_type" value="icon" class="h-5 w-5 text-primary" />
166
  <span class="ml-3 text-lg font-medium text-secondary">🧠 Document iconographique</span>
@@ -170,21 +200,29 @@
170
  </p>
171
  </label>
172
  </div>
173
- <button id="submit-btn" class="w-full mt-8 bg-primary hover:bg-primary-dark text-white font-bold py-3 px-6 rounded-lg transition-transform transform hover:-translate-y-1 hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed">
174
  🚀 Soumettre
175
  </button>
176
  </div>
177
  </div>
178
 
179
  <!-- Results Section -->
180
- <div id="results" class="mt-16 bg-white rounded-xl card p-8 hidden animate-fade-in">
181
- <h2 class="text-2xl font-semibold text-primary mb-6">📝 Résultat de l'analyse</h2>
 
 
 
 
 
 
 
 
182
  <div id="analysis-result" class="markdown-content prose max-w-none"></div>
183
  </div>
184
 
185
  <!-- Footer -->
186
- <footer class="mt-16 text-center text-gray-600">
187
- <hr class="my-6" />
188
  <p>© 2025 Mariam AI - Tous droits réservés.</p>
189
  </footer>
190
  </div>
@@ -199,35 +237,33 @@
199
 
200
  let uploadedFiles = [];
201
 
202
- // Configuration de marked pour mieux gérer les espaces et retours à la ligne
203
  marked.setOptions({
204
- breaks: true, // Convertit les retours à la ligne en <br>
205
- gfm: true, // GitHub Flavored Markdown
206
- headerIds: true, // Ajoute des IDs aux en-têtes
207
- mangle: false, // Pas de mangling des caractères spéciaux
208
- smartLists: true, // Meilleur rendu des listes
209
- smartypants: true, // Transforme les quotes, tirets etc.
210
- xhtml: true // Utilise la syntaxe XHTML
211
  });
212
 
213
  imageUpload.addEventListener('change', handleFileSelect);
214
  submitBtn.addEventListener('click', handleSubmit);
215
 
216
- // Support pour le drag and drop
217
  const uploadZone = document.querySelector('.upload-zone');
218
 
219
  uploadZone.addEventListener('dragover', (e) => {
220
  e.preventDefault();
221
- uploadZone.classList.add('bg-gray-50');
222
  });
223
 
224
  uploadZone.addEventListener('dragleave', () => {
225
- uploadZone.classList.remove('bg-gray-50');
226
  });
227
 
228
  uploadZone.addEventListener('drop', (e) => {
229
  e.preventDefault();
230
- uploadZone.classList.remove('bg-gray-50');
231
  uploadedFiles = Array.from(e.dataTransfer.files).filter(file => file.type.startsWith('image/'));
232
  updatePreview();
233
  });
@@ -241,15 +277,15 @@
241
  previewContainer.innerHTML = '';
242
  uploadedFiles.forEach((file, index) => {
243
  const preview = document.createElement('div');
244
- preview.className = 'relative';
245
  preview.innerHTML = `
246
- <img src="${URL.createObjectURL(file)}" alt="Preview" class="w-full h-32 object-cover rounded-lg shadow">
247
- <button onclick="removeImage(${index})" class="absolute top-2 right-2 bg-red-500 text-white rounded-full p-1 hover:bg-red-600 shadow">
248
  <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
249
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
250
  </svg>
251
  </button>
252
- <div class="mt-1 text-sm text-gray-600 truncate">${file.name}</div>
253
  `;
254
  previewContainer.appendChild(preview);
255
  });
@@ -261,6 +297,23 @@
261
  updatePreview();
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  async function handleSubmit() {
265
  if (uploadedFiles.length === 0) {
266
  alert('Veuillez sélectionner au moins une image.');
@@ -292,10 +345,7 @@
292
  throw new Error(data.error);
293
  }
294
 
295
- // Préparation des données Markdown pour l'affichage
296
  let markdownContent = data.result;
297
-
298
- // Assurer que les doubles retours à la ligne sont bien rendus
299
  markdownContent = markdownContent.replace(/\n\n/g, '\n&nbsp;\n');
300
 
301
  resultsSection.classList.remove('hidden');
 
12
  extend: {
13
  colors: {
14
  primary: '#4CAF50',
15
+ 'primary-dark': '#3e8e41',
16
  secondary: '#2D3748',
17
  accent: '#F6AD55'
18
  },
19
  fontFamily: {
20
  sans: ['Inter', 'sans-serif']
21
+ },
22
+ animation: {
23
+ 'gradient': 'gradient 8s ease infinite',
24
+ 'float': 'float 3s ease-in-out infinite'
25
+ },
26
+ keyframes: {
27
+ gradient: {
28
+ '0%, 100%': {
29
+ 'background-position': '0% 50%'
30
+ },
31
+ '50%': {
32
+ 'background-position': '100% 50%'
33
+ }
34
+ },
35
+ float: {
36
+ '0%, 100%': {
37
+ transform: 'translateY(0)'
38
+ },
39
+ '50%': {
40
+ transform: 'translateY(-10px)'
41
+ }
42
+ }
43
  }
44
  }
45
  }
46
  }
47
  </script>
48
  <style>
49
+ .gradient-bg {
50
+ background: linear-gradient(-45deg, #4CAF50, #81C784, #2E7D32, #1B5E20);
51
+ background-size: 400% 400%;
52
+ animation: gradient 8s ease infinite;
53
+ }
54
  .markdown-content {
55
  width: 100%;
56
  overflow-wrap: break-word;
 
64
  border-radius: 0.5rem;
65
  margin: 1rem 0;
66
  overflow-x: auto;
67
+ position: relative;
68
  }
69
  .markdown-content code {
70
  background-color: #edf2f7;
 
72
  border-radius: 0.25rem;
73
  font-family: ui-monospace, monospace;
74
  }
 
75
  .markdown-content p {
76
  margin-bottom: 1rem;
77
  line-height: 1.6;
78
  white-space: pre-line;
79
  }
 
80
  .markdown-content h1 {
81
  font-size: 1.8rem;
82
  font-weight: bold;
 
97
  margin-top: 1rem;
98
  margin-bottom: 0.5rem;
99
  }
 
100
  .markdown-content ul, .markdown-content ol {
101
  margin-left: 1.5rem;
102
  margin-bottom: 1rem;
 
104
  .markdown-content li {
105
  margin-bottom: 0.5rem;
106
  }
 
107
  .markdown-content blockquote {
108
  border-left: 4px solid #e2e8f0;
109
  padding-left: 1rem;
 
113
  font-style: italic;
114
  color: #4a5568;
115
  }
 
116
  .markdown-content hr {
117
  margin: 1.5rem 0;
118
  border: 0;
 
125
  .animate-fade-in {
126
  animation: fadeIn 1s ease-out;
127
  }
 
128
  .card {
129
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
130
+ backdrop-filter: blur(8px);
131
+ transition: all 0.3s ease;
132
+ }
133
+ .card:hover {
134
+ transform: translateY(-4px);
135
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
136
+ }
137
+ .glass-effect {
138
+ background: rgba(255, 255, 255, 0.95);
139
+ backdrop-filter: blur(10px);
140
  }
141
  </style>
142
  </head>
143
+ <body class="gradient-bg min-h-screen font-sans">
144
  <div class="container mx-auto px-4 py-12 max-w-6xl">
145
  <!-- Header -->
146
  <header class="text-center mb-16 animate-fade-in">
147
+ <h1 class="text-6xl font-bold text-white mb-4 drop-shadow-lg animate-float">
148
  ✨ Mariam Anglais ✨
149
  </h1>
150
+ <p class="text-white text-xl font-light tracking-wide">
151
  Téléchargez vos images, choisissez votre type d'analyse et laissez la magie opérer.
152
  </p>
153
  </header>
 
155
  <!-- Main Content -->
156
  <div class="grid md:grid-cols-2 gap-12">
157
  <!-- Upload Section -->
158
+ <div class="glass-effect rounded-2xl card p-8">
159
  <h2 class="text-2xl font-semibold text-primary mb-6 flex items-center gap-2">
160
  <svg class="h-8 w-8 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
161
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
 
163
  Téléchargement d'images
164
  </h2>
165
  <div
166
+ class="upload-zone border-3 border-dashed border-primary/50 rounded-lg p-10 text-center cursor-pointer hover:bg-white/50 transition-all duration-300"
167
  onclick="document.getElementById('image-upload').click()">
168
  <input type="file" id="image-upload" multiple accept="image/*" class="hidden" />
169
  <p class="text-gray-600 font-medium">Cliquez ou glissez vos images ici</p>
 
172
  </div>
173
 
174
  <!-- Analysis Type Section -->
175
+ <div class="glass-effect rounded-2xl card p-8">
176
  <h2 class="text-2xl font-semibold text-primary mb-6 flex items-center gap-2">
177
  <svg class="h-8 w-8 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
178
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2a4 4 0 00-4-4H3"></path>
 
181
  Choix du type d'analyse
182
  </h2>
183
  <div class="space-y-6">
184
+ <label class="flex flex-col p-5 rounded-lg border-2 border-gray-200 cursor-pointer hover:border-primary/50 hover:bg-white/50 transition-all duration-300">
 
185
  <div class="flex items-center">
186
  <input type="radio" name="analysis_type" value="text" class="h-5 w-5 text-primary" />
187
  <span class="ml-3 text-lg font-medium text-secondary">🔍 Analyse de Texte</span>
 
190
  Analyse de texte détaillée comprenant INTRODUCTION, SUMMARY, COMMENTARY et EVALUATION.
191
  </p>
192
  </label>
193
+ <label class="flex flex-col p-5 rounded-lg border-2 border-gray-200 cursor-pointer hover:border-primary/50 hover:bg-white/50 transition-all duration-300">
 
194
  <div class="flex items-center">
195
  <input type="radio" name="analysis_type" value="icon" class="h-5 w-5 text-primary" />
196
  <span class="ml-3 text-lg font-medium text-secondary">🧠 Document iconographique</span>
 
200
  </p>
201
  </label>
202
  </div>
203
+ <button id="submit-btn" class="w-full mt-8 bg-primary hover:bg-primary-dark text-white font-bold py-4 px-6 rounded-xl transition-all duration-300 transform hover:-translate-y-1 hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed">
204
  🚀 Soumettre
205
  </button>
206
  </div>
207
  </div>
208
 
209
  <!-- Results Section -->
210
+ <div id="results" class="mt-16 glass-effect rounded-2xl card p-8 hidden animate-fade-in">
211
+ <div class="flex justify-between items-center mb-6">
212
+ <h2 class="text-2xl font-semibold text-primary">📝 Résultat de l'analyse</h2>
213
+ <button onclick="copyResults()" class="flex items-center gap-2 bg-primary/10 hover:bg-primary/20 text-primary px-4 py-2 rounded-lg transition-all duration-300">
214
+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
215
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"></path>
216
+ </svg>
217
+ Copier
218
+ </button>
219
+ </div>
220
  <div id="analysis-result" class="markdown-content prose max-w-none"></div>
221
  </div>
222
 
223
  <!-- Footer -->
224
+ <footer class="mt-16 text-center text-white">
225
+ <hr class="my-6 border-white/20" />
226
  <p>© 2025 Mariam AI - Tous droits réservés.</p>
227
  </footer>
228
  </div>
 
237
 
238
  let uploadedFiles = [];
239
 
 
240
  marked.setOptions({
241
+ breaks: true,
242
+ gfm: true,
243
+ headerIds: true,
244
+ mangle: false,
245
+ smartLists: true,
246
+ smartypants: true,
247
+ xhtml: true
248
  });
249
 
250
  imageUpload.addEventListener('change', handleFileSelect);
251
  submitBtn.addEventListener('click', handleSubmit);
252
 
 
253
  const uploadZone = document.querySelector('.upload-zone');
254
 
255
  uploadZone.addEventListener('dragover', (e) => {
256
  e.preventDefault();
257
+ uploadZone.classList.add('bg-white/50');
258
  });
259
 
260
  uploadZone.addEventListener('dragleave', () => {
261
+ uploadZone.classList.remove('bg-white/50');
262
  });
263
 
264
  uploadZone.addEventListener('drop', (e) => {
265
  e.preventDefault();
266
+ uploadZone.classList.remove('bg-white/50');
267
  uploadedFiles = Array.from(e.dataTransfer.files).filter(file => file.type.startsWith('image/'));
268
  updatePreview();
269
  });
 
277
  previewContainer.innerHTML = '';
278
  uploadedFiles.forEach((file, index) => {
279
  const preview = document.createElement('div');
280
+ preview.className = 'relative group';
281
  preview.innerHTML = `
282
+ <img src="${URL.createObjectURL(file)}" alt="Preview" class="w-full h-32 object-cover rounded-lg shadow group-hover:opacity-75 transition-all duration-300">
283
+ <button onclick="removeImage(${index})" class="absolute top-2 right-2 bg-red-500 text-white rounded-full p-2 opacity-0 group-hover:opacity-100 hover:bg-red-600 transition-all duration-300 shadow">
284
  <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
285
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
286
  </svg>
287
  </button>
288
+ <div class="mt-2 text-sm text-gray-600 truncate">${file.name}</div>
289
  `;
290
  previewContainer.appendChild(preview);
291
  });
 
297
  updatePreview();
298
  }
299
 
300
+ window.copyResults = function() {
301
+ const textToCopy = analysisResult.textContent;
302
+ navigator.clipboard.writeText(textToCopy).then(() => {
303
+ const copyButton = document.querySelector('button[onclick="copyResults()"]');
304
+ const originalContent = copyButton.innerHTML;
305
+ copyButton.innerHTML = `
306
+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
307
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
308
+ </svg>
309
+ Copié!
310
+ `;
311
+ setTimeout(() => {
312
+ copyButton.innerHTML = originalContent;
313
+ }, 2000);
314
+ });
315
+ };
316
+
317
  async function handleSubmit() {
318
  if (uploadedFiles.length === 0) {
319
  alert('Veuillez sélectionner au moins une image.');
 
345
  throw new Error(data.error);
346
  }
347
 
 
348
  let markdownContent = data.result;
 
 
349
  markdownContent = markdownContent.replace(/\n\n/g, '\n&nbsp;\n');
350
 
351
  resultsSection.classList.remove('hidden');