Docfile commited on
Commit
ec5066b
1 Parent(s): 9398dd5

Update templates/math.html

Browse files
Files changed (1) hide show
  1. templates/math.html +90 -32
templates/math.html CHANGED
@@ -3,20 +3,29 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Résolution de Problèmes Mathématiques</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script defer src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
9
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
10
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
 
 
 
11
  <style>
 
 
 
12
  .dropzone {
13
- border: 2px dashed #4F46E5;
14
  transition: all 0.3s ease;
 
 
 
15
  }
16
 
17
  .dropzone:hover {
18
- border-color: #312E81;
19
- background-color: rgba(79, 70, 229, 0.1);
20
  }
21
 
22
  .loading {
@@ -60,18 +69,64 @@
60
  justify-content: space-between;
61
  align-items: center;
62
  padding: 0.75rem 1rem;
63
- background-color: #f3f4f6;
64
- border-bottom: 1px solid #e5e7eb;
 
 
65
  }
66
 
67
  .saved-response-content {
68
  padding: 1rem;
69
  display: none;
 
70
  }
71
 
72
  .saved-response-item.open .saved-response-content {
73
  display: block;
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  </style>
76
  <script>
77
  window.MathJax = {
@@ -123,22 +178,24 @@
123
  <script src="https://cdn.jsdelivr.net/npm/localforage@1.10.0/dist/localforage.min.js"></script>
124
  </head>
125
 
126
- <body class="min-h-screen bg-gradient-to-br from-blue-50 to-white">
127
  <div class="container mx-auto px-4 py-8 max-w-4xl">
128
  <header class="text-center mb-12">
129
- <h1 class="text-4xl font-bold text-blue-800 mb-4">Résolution de Problèmes Mathématiques</h1>
130
- <p class="text-gray-600 text-lg">Soumettez une image de votre problème mathématique pour obtenir une
131
- solution détaillée</p>
 
 
132
  </header>
133
  <div class="mb-8">
134
  <form id="uploadForm" class="space-y-4">
135
  <div id="dropzone"
136
- class="dropzone rounded-lg p-8 text-center cursor-pointer bg-white shadow-sm hover:shadow-md transition-all">
137
  <input type="file" id="fileInput" class="hidden" accept="image/*">
138
  <div class="flex flex-col items-center space-y-4">
139
- <i class="fas fa-cloud-upload-alt text-4xl text-blue-600"></i>
140
- <div class="text-lg text-gray-700">
141
- Glissez votre image ici ou <span class="text-blue-600 font-semibold">cliquez pour
142
  sélectionner</span>
143
  </div>
144
  <p class="text-sm text-gray-500">Formats acceptés: PNG, JPG, JPEG</p>
@@ -146,21 +203,21 @@
146
  </div>
147
 
148
  <div class="space-y-4">
149
- <label for="customInstruction" class="block text-gray-700 font-medium">Instruction
150
- personnalisée(pas obligatoire)</label>
151
  <input type="text" id="customInstruction" name="custom_instruction"
152
- class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500"
153
  placeholder="Exemple : Résoudre en utilisant le théorème de Pythagore">
154
  </div>
155
 
156
- <div class="flex justify-center items-center space-x-4">
157
  <select id="modelChoice" name="model_choice"
158
- class="rounded-md border-gray-300 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
159
  <option value="mariam's">Mariam's (Rapide et performant)</option>
160
  <option value="qwen2">Qwen2 (lent mais plus performant)</option>
161
  </select>
162
  <button type="submit"
163
- class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors duration-200 flex items-center space-x-2 disabled:opacity-50 disabled:cursor-not-allowed">
164
  <i class="fas fa-paper-plane"></i>
165
  <span>Analyser l'image</span>
166
  </button>
@@ -169,13 +226,13 @@
169
  </div>
170
 
171
  <div id="loading" class="loading flex-col items-center justify-center space-y-4 my-8">
172
- <div class="animate-spin rounded-full h-12 w-12 border-4 border-blue-200 border-t-blue-600"></div>
173
- <p class="text-gray-700 font-medium">Analyse en cours...</p>
174
  </div>
175
 
176
  <div id="response" class="hidden">
177
- <div class="bg-white rounded-lg shadow-lg p-6 mb-8">
178
- <h2 id="modelUsed" class="text-2xl font-semibold text-blue-800 mb-4">Solution (Modèle: <span
179
  id="modelName"></span>)</h2>
180
  <div id="latexContent" class="prose max-w-none math-content math-hidden"></div>
181
  </div>
@@ -183,23 +240,24 @@
183
 
184
  <div id="savedResponsesSection" class="mt-8">
185
  <div class="flex justify-between items-center mb-4">
186
- <h2 class="text-2xl font-semibold text-blue-800">Réponses Sauvegardées</h2>
187
  <button id="clearSavedResponses"
188
- class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors duration-200">
189
  <i class="fas fa-trash-alt"></i> Effacer Tout
190
  </button>
191
  </div>
192
- <div id="savedResponses" class="space-y-2"></div>
193
  </div>
194
 
195
  <div id="errorMessage"
196
- class="hidden bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative my-4" role="alert">
197
  <strong class="font-bold">Erreur!</strong>
198
  <span class="block sm:inline" id="errorText"></span>
199
  </div>
200
  </div>
201
 
202
  <script>
 
203
  document.addEventListener('DOMContentLoaded', function () {
204
  const dropzone = document.getElementById('dropzone');
205
  const fileInput = document.getElementById('fileInput');
@@ -365,15 +423,15 @@
365
  const [, timestamp, model] = key.split('-');
366
  const responseItem = document.createElement('div');
367
  responseItem.className =
368
- 'saved-response-item bg-white rounded-lg shadow-md overflow-hidden';
369
 
370
  const header = document.createElement('div');
371
  header.className = 'saved-response-header';
372
  header.innerHTML = `
373
- <span class="text-blue-800 font-medium">Réponse du ${new Date(parseInt(timestamp)).toLocaleString()} (Modèle: ${model})</span>
374
  <div>
375
- <button class="toggle-content px-1 py-0.5 rounded-md text-xs bg-blue-500 hover:bg-blue-700 text-white mr-1"><i class="fas fa-chevron-down"></i></button>
376
- <button class="delete-response px-1 py-0.5 rounded-md text-xs bg-red-500 hover:bg-red-700 text-white"><i class="fas fa-trash-alt"></i></button>
377
  </div>
378
  `;
379
  responseItem.appendChild(header);
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Mariam - Résolution de Problèmes Mathématiques</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script defer src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
9
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
10
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
11
+ <link rel="preconnect" href="https://fonts.googleapis.com">
12
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
13
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
14
  <style>
15
+ body {
16
+ font-family: 'Poppins', sans-serif;
17
+ }
18
  .dropzone {
19
+ border: 3px dashed #3b82f6; /* Increased border thickness */
20
  transition: all 0.3s ease;
21
+ border-radius: 10px; /* More rounded corners */
22
+ padding: 3rem; /* Increased padding */
23
+ background-color: #f5f5f5; /* Lighter background color */
24
  }
25
 
26
  .dropzone:hover {
27
+ border-color: #2563eb;
28
+ background-color: rgba(59, 130, 246, 0.1);
29
  }
30
 
31
  .loading {
 
69
  justify-content: space-between;
70
  align-items: center;
71
  padding: 0.75rem 1rem;
72
+ background-color: #e5e7eb; /* Changed background color */
73
+ border-bottom: 1px solid #d1d5db; /* Changed border color */
74
+ border-radius: 8px; /* Added border-radius */
75
+ font-weight: 500; /* Added font weight */
76
  }
77
 
78
  .saved-response-content {
79
  padding: 1rem;
80
  display: none;
81
+ border-radius: 8px; /* Added border-radius */
82
  }
83
 
84
  .saved-response-item.open .saved-response-content {
85
  display: block;
86
  }
87
+ /* Custom button style */
88
+ .btn {
89
+ padding: 0.75rem 1.5rem;
90
+ border-radius: 0.5rem;
91
+ font-weight: 600;
92
+ transition: all 0.3s ease;
93
+ }
94
+
95
+ .btn-primary {
96
+ background-color: #3b82f6;
97
+ color: #fff;
98
+ }
99
+
100
+ .btn-primary:hover {
101
+ background-color: #2563eb;
102
+ }
103
+
104
+ .btn-danger {
105
+ background-color: #ef4444;
106
+ color: #fff;
107
+ }
108
+
109
+ .btn-danger:hover {
110
+ background-color: #dc2626;
111
+ }
112
+
113
+ /* Custom select style */
114
+ .select {
115
+ border: 1px solid #d1d5db;
116
+ border-radius: 0.5rem;
117
+ padding: 0.75rem 1rem;
118
+ appearance: none;
119
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
120
+ background-repeat: no-repeat;
121
+ background-position: right 0.75rem center;
122
+ background-size: 1em;
123
+ padding-right: 2.5rem;
124
+ }
125
+
126
+ .select:focus {
127
+ outline: none;
128
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
129
+ }
130
  </style>
131
  <script>
132
  window.MathJax = {
 
178
  <script src="https://cdn.jsdelivr.net/npm/localforage@1.10.0/dist/localforage.min.js"></script>
179
  </head>
180
 
181
+ <body class="bg-gray-100">
182
  <div class="container mx-auto px-4 py-8 max-w-4xl">
183
  <header class="text-center mb-12">
184
+ <h1 class="text-4xl font-bold text-blue-600 mb-4">
185
+ <span class="bg-gradient-to-r from-blue-500 to-blue-700 text-transparent bg-clip-text">Mariam</span>
186
+ - Résolution de Problèmes Mathématiques
187
+ </h1>
188
+ <p class="text-gray-500 text-lg">Votre assistant intelligent pour des solutions mathématiques détaillées</p>
189
  </header>
190
  <div class="mb-8">
191
  <form id="uploadForm" class="space-y-4">
192
  <div id="dropzone"
193
+ class="dropzone rounded-lg text-center cursor-pointer shadow-md hover:shadow-lg transition-all">
194
  <input type="file" id="fileInput" class="hidden" accept="image/*">
195
  <div class="flex flex-col items-center space-y-4">
196
+ <i class="fas fa-cloud-upload-alt text-6xl text-blue-500"></i>
197
+ <div class="text-lg text-gray-600">
198
+ Glissez votre image ici ou <span class="text-blue-500 font-semibold">cliquez pour
199
  sélectionner</span>
200
  </div>
201
  <p class="text-sm text-gray-500">Formats acceptés: PNG, JPG, JPEG</p>
 
203
  </div>
204
 
205
  <div class="space-y-4">
206
+ <label for="customInstruction" class="block text-gray-600 font-medium">Instruction
207
+ personnalisée (optionnel)</label>
208
  <input type="text" id="customInstruction" name="custom_instruction"
209
+ class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
210
  placeholder="Exemple : Résoudre en utilisant le théorème de Pythagore">
211
  </div>
212
 
213
+ <div class="flex flex-col md:flex-row justify-center items-center space-y-4 md:space-y-0 md:space-x-4">
214
  <select id="modelChoice" name="model_choice"
215
+ class="select w-full md:w-auto">
216
  <option value="mariam's">Mariam's (Rapide et performant)</option>
217
  <option value="qwen2">Qwen2 (lent mais plus performant)</option>
218
  </select>
219
  <button type="submit"
220
+ class="btn btn-primary w-full md:w-auto flex items-center space-x-2 disabled:opacity-50 disabled:cursor-not-allowed">
221
  <i class="fas fa-paper-plane"></i>
222
  <span>Analyser l'image</span>
223
  </button>
 
226
  </div>
227
 
228
  <div id="loading" class="loading flex-col items-center justify-center space-y-4 my-8">
229
+ <div class="animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500"></div>
230
+ <p class="text-gray-600 font-medium text-lg">Analyse en cours...</p>
231
  </div>
232
 
233
  <div id="response" class="hidden">
234
+ <div class="bg-white rounded-xl shadow-lg p-6 mb-8">
235
+ <h2 id="modelUsed" class="text-2xl font-semibold text-blue-600 mb-4">Solution (Modèle: <span
236
  id="modelName"></span>)</h2>
237
  <div id="latexContent" class="prose max-w-none math-content math-hidden"></div>
238
  </div>
 
240
 
241
  <div id="savedResponsesSection" class="mt-8">
242
  <div class="flex justify-between items-center mb-4">
243
+ <h2 class="text-2xl font-semibold text-blue-600">Réponses Sauvegardées</h2>
244
  <button id="clearSavedResponses"
245
+ class="btn btn-danger">
246
  <i class="fas fa-trash-alt"></i> Effacer Tout
247
  </button>
248
  </div>
249
+ <div id="savedResponses" class="space-y-4"></div>
250
  </div>
251
 
252
  <div id="errorMessage"
253
+ class="hidden bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg relative my-4" role="alert">
254
  <strong class="font-bold">Erreur!</strong>
255
  <span class="block sm:inline" id="errorText"></span>
256
  </div>
257
  </div>
258
 
259
  <script>
260
+ // JavaScript code (same as before, but with minor adjustments if needed)
261
  document.addEventListener('DOMContentLoaded', function () {
262
  const dropzone = document.getElementById('dropzone');
263
  const fileInput = document.getElementById('fileInput');
 
423
  const [, timestamp, model] = key.split('-');
424
  const responseItem = document.createElement('div');
425
  responseItem.className =
426
+ 'saved-response-item bg-gray-100 rounded-lg shadow-md overflow-hidden';
427
 
428
  const header = document.createElement('div');
429
  header.className = 'saved-response-header';
430
  header.innerHTML = `
431
+ <span class="text-blue-600 font-medium">Réponse du ${new Date(parseInt(timestamp)).toLocaleString()} (Modèle: ${model})</span>
432
  <div>
433
+ <button class="toggle-content px-2 py-1 rounded-md text-xs bg-blue-500 hover:bg-blue-700 text-white mr-1"><i class="fas fa-chevron-down"></i></button>
434
+ <button class="delete-response px-2 py-1 rounded-md text-xs bg-red-500 hover:bg-red-700 text-white"><i class="fas fa-trash-alt"></i></button>
435
  </div>
436
  `;
437
  responseItem.appendChild(header);