Docfile commited on
Commit
93fbcde
·
verified ·
1 Parent(s): 2480afe

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +147 -50
templates/index.html CHANGED
@@ -1,8 +1,8 @@
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>Mariam Anglais</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
@@ -13,6 +13,11 @@
13
  colors: {
14
  primary: '#4CAF50',
15
  'primary-dark': '#3e8e41',
 
 
 
 
 
16
  }
17
  }
18
  }
@@ -22,109 +27,164 @@
22
  .markdown-content {
23
  width: 100%;
24
  overflow-wrap: break-word;
25
- word-wrap: break-word;
26
  word-break: break-word;
27
  hyphens: auto;
28
  }
29
-
30
  .markdown-content pre {
31
  white-space: pre-wrap;
32
- word-wrap: break-word;
33
  padding: 1rem;
34
- background-color: #f3f4f6;
35
  border-radius: 0.5rem;
36
  margin: 1rem 0;
37
  overflow-x: auto;
38
  }
39
-
40
  .markdown-content code {
41
- background-color: #f3f4f6;
42
  padding: 0.2rem 0.4rem;
43
  border-radius: 0.25rem;
44
  font-family: ui-monospace, monospace;
45
  }
46
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  @keyframes fadeIn {
48
  from { opacity: 0; }
49
  to { opacity: 1; }
50
  }
51
-
52
  .animate-fade-in {
53
  animation: fadeIn 1s ease-out;
54
  }
 
 
 
 
55
  </style>
56
  </head>
57
- <body class="bg-gray-50 min-h-screen">
58
- <div class="container mx-auto px-4 py-8 max-w-6xl">
59
  <!-- Header -->
60
- <header class="text-center mb-12 animate-fade-in">
61
- <h1 class="text-5xl font-bold text-primary mb-4">
62
  ✨ Mariam Anglais ✨
63
  </h1>
64
- <p class="text-gray-600 text-lg">
65
- Bienvenue ! Téléchargez vos images, choisissez votre type d'analyse, et laissez la magie opérer.
66
  </p>
67
  </header>
68
 
69
  <!-- Main Content -->
70
- <div class="grid md:grid-cols-2 gap-8">
71
  <!-- Upload Section -->
72
- <div class="bg-white rounded-xl shadow-lg p-6">
73
- <h2 class="text-2xl font-semibold text-primary mb-4">📷 Téléchargement d'images</h2>
 
 
 
 
 
74
  <div
75
- class="upload-zone border-2 border-dashed border-primary rounded-lg p-8 text-center cursor-pointer hover:bg-gray-50 transition-colors"
76
  onclick="document.getElementById('image-upload').click()">
77
- <input type="file" id="image-upload" multiple accept="image/*" class="hidden">
78
- <div class="flex flex-col items-center">
79
- <svg class="h-12 w-12 text-primary mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
80
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
81
- </svg>
82
- <span class="text-gray-600">Cliquez ou glissez vos images ici</span>
83
- </div>
84
  </div>
85
- <div id="preview-container" class="mt-4 grid grid-cols-2 gap-4"></div>
86
  </div>
87
 
88
  <!-- Analysis Type Section -->
89
- <div class="bg-white rounded-xl shadow-lg p-6">
90
- <h2 class="text-2xl font-semibold text-primary mb-4">🎛️ Choix du type d'analyse</h2>
91
- <div class="space-y-4">
 
 
 
 
 
 
92
  <!-- Option Analyse de Texte -->
93
- <label class="flex flex-col p-4 rounded-lg border border-gray-200 cursor-pointer hover:bg-gray-50 transition-colors">
94
  <div class="flex items-center">
95
- <input type="radio" name="analysis_type" value="text" class="h-4 w-4 text-primary">
96
- <span class="ml-3 font-medium">🔍 Analyse de Texte</span>
97
  </div>
98
- <p class="text-gray-500 text-sm ml-7 mt-1">
99
- Il s'agit ici de l'analyse de texte avec (INTRODUCTION, SUMMARY, COMMENTARY, EVALUATION).
100
  </p>
101
  </label>
102
  <!-- Option Document iconographique -->
103
- <label class="flex flex-col p-4 rounded-lg border border-gray-200 cursor-pointer hover:bg-gray-50 transition-colors">
104
  <div class="flex items-center">
105
- <input type="radio" name="analysis_type" value="icon" class="h-4 w-4 text-primary">
106
- <span class="ml-3 font-medium">🧠 Document iconographique</span>
107
  </div>
108
- <p class="text-gray-500 text-sm ml-7 mt-1">
109
- Il s'agit ici du document iconographique.
110
  </p>
111
  </label>
112
  </div>
113
- <button id="submit-btn" class="w-full mt-6 bg-primary hover:bg-primary-dark text-white font-bold py-3 px-6 rounded-lg transition-all transform hover:-translate-y-1 hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed">
114
  🚀 Soumettre
115
  </button>
116
  </div>
117
  </div>
118
 
119
  <!-- Results Section -->
120
- <div id="results" class="mt-12 bg-white rounded-xl shadow-lg p-6 hidden animate-fade-in">
121
- <h2 class="text-2xl font-semibold text-primary mb-4">📝 Résultat de l'analyse</h2>
122
  <div id="analysis-result" class="markdown-content prose max-w-none"></div>
123
  </div>
124
 
125
  <!-- Footer -->
126
- <footer class="mt-12 text-center text-gray-600">
127
- <hr class="my-4">
128
  <p>© 2025 Mariam AI - Tous droits réservés.</p>
129
  </footer>
130
  </div>
@@ -139,8 +199,38 @@
139
 
140
  let uploadedFiles = [];
141
 
 
 
 
 
 
 
 
 
 
 
 
142
  imageUpload.addEventListener('change', handleFileSelect);
143
  submitBtn.addEventListener('click', handleSubmit);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  function handleFileSelect(event) {
146
  uploadedFiles = Array.from(event.target.files);
@@ -153,12 +243,13 @@
153
  const preview = document.createElement('div');
154
  preview.className = 'relative';
155
  preview.innerHTML = `
156
- <img src="${URL.createObjectURL(file)}" alt="Preview" class="w-full h-32 object-cover rounded-lg">
157
- <button onclick="removeImage(${index})" class="absolute top-2 right-2 bg-red-500 text-white rounded-full p-1 hover:bg-red-600">
158
  <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
159
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
160
  </svg>
161
  </button>
 
162
  `;
163
  previewContainer.appendChild(preview);
164
  });
@@ -201,8 +292,14 @@
201
  throw new Error(data.error);
202
  }
203
 
 
 
 
 
 
 
204
  resultsSection.classList.remove('hidden');
205
- analysisResult.innerHTML = marked.parse(data.result);
206
  resultsSection.scrollIntoView({ behavior: 'smooth' });
207
  } catch (error) {
208
  alert('Erreur lors de l\'analyse: ' + error.message);
@@ -216,4 +313,4 @@
216
  });
217
  </script>
218
  </body>
219
- </html>
 
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>Mariam Anglais</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
 
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
  }
 
27
  .markdown-content {
28
  width: 100%;
29
  overflow-wrap: break-word;
 
30
  word-break: break-word;
31
  hyphens: auto;
32
  }
 
33
  .markdown-content pre {
34
  white-space: pre-wrap;
 
35
  padding: 1rem;
36
+ background-color: #edf2f7;
37
  border-radius: 0.5rem;
38
  margin: 1rem 0;
39
  overflow-x: auto;
40
  }
 
41
  .markdown-content code {
42
+ background-color: #edf2f7;
43
  padding: 0.2rem 0.4rem;
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;
57
+ margin-top: 1.5rem;
58
+ margin-bottom: 1rem;
59
+ padding-bottom: 0.5rem;
60
+ border-bottom: 1px solid #e2e8f0;
61
+ }
62
+ .markdown-content h2 {
63
+ font-size: 1.5rem;
64
+ font-weight: bold;
65
+ margin-top: 1.25rem;
66
+ margin-bottom: 0.75rem;
67
+ }
68
+ .markdown-content h3 {
69
+ font-size: 1.25rem;
70
+ font-weight: bold;
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;
78
+ }
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;
86
+ margin-left: 0;
87
+ margin-right: 0;
88
+ margin-bottom: 1rem;
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;
96
+ border-top: 1px solid #e2e8f0;
97
+ }
98
  @keyframes fadeIn {
99
  from { opacity: 0; }
100
  to { opacity: 1; }
101
  }
 
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>
122
 
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>
130
+ </svg>
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>
 
 
 
 
 
138
  </div>
139
+ <div id="preview-container" class="mt-6 grid grid-cols-2 gap-4"></div>
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>
147
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a4 4 0 014 4v2"></path>
148
+ </svg>
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>
157
  </div>
158
+ <p class="text-gray-500 text-sm ml-8 mt-1">
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>
167
  </div>
168
+ <p class="text-gray-500 text-sm ml-8 mt-1">
169
+ Analyse et interprétation du document iconographique fourni.
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
 
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
+ });
234
 
235
  function handleFileSelect(event) {
236
  uploadedFiles = Array.from(event.target.files);
 
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
  });
 
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');
302
+ analysisResult.innerHTML = marked.parse(markdownContent);
303
  resultsSection.scrollIntoView({ behavior: 'smooth' });
304
  } catch (error) {
305
  alert('Erreur lors de l\'analyse: ' + error.message);
 
313
  });
314
  </script>
315
  </body>
316
+ </html>