Docfile commited on
Commit
a8f80bb
·
verified ·
1 Parent(s): dc18a3c

Delete templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +0 -370
templates/index.html DELETED
@@ -1,370 +0,0 @@
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 M-0 | Solution Mathématique</title>
7
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
8
- <script>
9
- window.MathJax = {
10
- tex: {
11
- inlineMath: [['$', '$'], ['\\(', '\\)']],
12
- displayMath: [['$$', '$$'], ['\\[', '\\]']],
13
- processEscapes: true,
14
- packages: ['base', 'ams', 'noerrors', 'noundefined']
15
- },
16
- options: {
17
- ignoreHtmlClass: 'tex2jax_ignore',
18
- processHtmlClass: 'tex2jax_process'
19
- },
20
- svg: {
21
- fontCache: 'global'
22
- }
23
- };
24
- </script>
25
- <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
26
- <style>
27
- @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
28
-
29
- body {
30
- font-family: 'Space Grotesk', sans-serif;
31
- background: linear-gradient(125deg, #000428 0%, #004e92 100%);
32
- min-height: 100vh;
33
- }
34
-
35
- .glass-card {
36
- background: rgba(255, 255, 255, 0.05);
37
- backdrop-filter: blur(10px);
38
- border: 1px solid rgba(255, 255, 255, 0.1);
39
- box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
40
- }
41
-
42
- .uploadArea {
43
- background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
44
- border: 2px dashed rgba(255, 255, 255, 0.2);
45
- }
46
-
47
- .uploadArea:hover {
48
- border-color: #60A5FA;
49
- transform: translateY(-2px);
50
- }
51
-
52
- .neon-button {
53
- background: linear-gradient(90deg, #4F46E5 0%, #60A5FA 100%);
54
- box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
55
- transition: all 0.3s ease;
56
- }
57
-
58
- .neon-button:hover {
59
- box-shadow: 0 0 25px rgba(79, 70, 229, 0.7);
60
- transform: translateY(-2px);
61
- }
62
-
63
- .loader {
64
- width: 48px;
65
- height: 48px;
66
- border: 3px solid #FFF;
67
- border-bottom-color: transparent;
68
- border-radius: 50%;
69
- display: inline-block;
70
- box-sizing: border-box;
71
- animation: rotation 1s linear infinite;
72
- }
73
-
74
- @keyframes rotation {
75
- 0% { transform: rotate(0deg); }
76
- 100% { transform: rotate(360deg); }
77
- }
78
-
79
- .thought-box {
80
- transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
81
- max-height: 0;
82
- overflow: hidden;
83
- }
84
-
85
- .thought-box.open {
86
- max-height: 1000px;
87
- }
88
-
89
- .glow {
90
- animation: glow 2s ease-in-out infinite alternate;
91
- }
92
-
93
- @keyframes glow {
94
- from { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #60A5FA; }
95
- to { text-shadow: 0 0 20px #fff, 0 0 30px #4F46E5, 0 0 40px #4F46E5; }
96
- }
97
-
98
- .preview-container {
99
- display: flex;
100
- justify-content: center;
101
- align-items: center;
102
- margin-top: 20px;
103
- }
104
-
105
- .preview-image {
106
- max-width: 300px;
107
- max-height: 300px;
108
- border-radius: 8px;
109
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
110
- }
111
-
112
- #thoughtsContent, #answerContent {
113
- max-height: 500px;
114
- overflow-y: auto;
115
- }
116
-
117
- .timestamp {
118
- color: #60A5FA;
119
- margin-left: 10px;
120
- font-size: 0.9em;
121
- }
122
- </style>
123
- </head>
124
- <body class="p-4 md:p-8">
125
- <div class="container mx-auto max-w-4xl">
126
- <div class="glass-card rounded-3xl p-8 md:p-12">
127
- <div class="text-center mb-12">
128
- <h1 class="text-5xl font-bold text-white glow mb-4">Mariam M-0</h1>
129
- <p class="text-blue-200 text-lg">Solution Mathématique Intelligente</p>
130
- </div>
131
-
132
- <form id="problemForm" class="space-y-8" enctype="multipart/form-data">
133
- <div class="relative">
134
- <div class="uploadArea rounded-2xl p-12 text-center transition-all duration-300 cursor-pointer">
135
- <input type="file" id="imageInput" name="image" accept="image/*" class="absolute inset-0 w-full h-full opacity-0 cursor-pointer">
136
- <div class="space-y-4">
137
- <div class="w-20 h-20 mx-auto border-2 border-blue-400 rounded-full flex items-center justify-center">
138
- <svg class="w-10 h-10 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
139
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
140
- </svg>
141
- </div>
142
- <div class="text-blue-200 text-lg font-medium">Déposez votre image ici</div>
143
- <div class="text-blue-300/60 text-sm">ou cliquez pour sélectionner</div>
144
- </div>
145
- </div>
146
- <div id="imagePreview" class="preview-container hidden">
147
- <img id="previewImage" src="#" alt="Prévisualisation de l'image" class="preview-image">
148
- </div>
149
- </div>
150
-
151
- <button type="submit" class="neon-button w-full py-4 rounded-xl text-white font-medium text-lg transition-all duration-300">
152
- Résoudre le problème
153
- </button>
154
- </form>
155
-
156
- <div id="loader" class="hidden mt-12">
157
- <div class="flex flex-col items-center justify-center space-y-4">
158
- <span class="loader"></span>
159
- <div class="text-blue-200 text-lg">Analyse en cours...</div>
160
- </div>
161
- </div>
162
-
163
- <div id="solution" class="hidden mt-12 space-y-8">
164
- <div class="glass-card rounded-2xl p-6">
165
- <button id="thoughtsToggle" class="w-full flex justify-between items-center text-left text-lg font-medium text-white hover:text-blue-300 transition-colors">
166
- <div class="flex items-center">
167
- <span>Processus de Réflexion</span>
168
- <span id="timestamp" class="timestamp"></span>
169
- </div>
170
- <svg class="w-6 h-6 transform transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
171
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
172
- </svg>
173
- </button>
174
- <div id="thoughtsBox" class="thought-box">
175
- <div id="thoughtsContent" class="prose prose-invert max-w-none text-blue-100 mt-4"></div>
176
- </div>
177
- </div>
178
-
179
- <div class="glass-card rounded-2xl p-8">
180
- <h3 class="text-2xl font-bold text-white mb-6">Solution</h3>
181
- <div id="answerContent" class="prose prose-invert max-w-none text-blue-100"></div>
182
- </div>
183
- </div>
184
- </div>
185
- </div>
186
-
187
- <script>
188
- document.addEventListener('DOMContentLoaded', () => {
189
- const form = document.getElementById('problemForm');
190
- const imageInput = document.getElementById('imageInput');
191
- const loader = document.getElementById('loader');
192
- const solutionDiv = document.getElementById('solution');
193
- const thoughtsContent = document.getElementById('thoughtsContent');
194
- const answerContent = document.getElementById('answerContent');
195
- const thoughtsToggle = document.getElementById('thoughtsToggle');
196
- const thoughtsBox = document.getElementById('thoughtsBox');
197
- const imagePreview = document.getElementById('imagePreview');
198
- const previewImage = document.getElementById('previewImage');
199
- const timestamp = document.getElementById('timestamp');
200
-
201
- let startTime = null;
202
- let timerInterval = null;
203
-
204
- function updateTimestamp() {
205
- if (startTime) {
206
- const elapsed = Math.floor((Date.now() - startTime) / 1000);
207
- timestamp.textContent = elapsed + "s";
208
- }
209
- }
210
-
211
- function startTimer() {
212
- startTime = Date.now();
213
- timerInterval = setInterval(updateTimestamp, 1000);
214
- updateTimestamp();
215
- }
216
-
217
- function stopTimer() {
218
- if (timerInterval) {
219
- clearInterval(timerInterval);
220
- timerInterval = null;
221
- }
222
- startTime = null;
223
- timestamp.textContent = "";
224
- }
225
-
226
- thoughtsToggle.addEventListener('click', () => {
227
- thoughtsBox.classList.toggle('open');
228
- thoughtsToggle.querySelector('svg').classList.toggle('rotate-180');
229
- });
230
-
231
- imageInput.addEventListener('change', function(e) {
232
- const file = this.files[0];
233
- if (file) {
234
- const reader = new FileReader();
235
- reader.onload = function(e) {
236
- previewImage.src = e.target.result;
237
- imagePreview.classList.remove('hidden');
238
- }
239
- reader.readAsDataURL(file);
240
- } else {
241
- previewImage.src = "";
242
- imagePreview.classList.add('hidden');
243
- }
244
- });
245
-
246
- const dropZone = document.querySelector('.uploadArea');
247
-
248
- ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
249
- dropZone.addEventListener(eventName, preventDefaults, false);
250
- });
251
-
252
- function preventDefaults(e) {
253
- e.preventDefault();
254
- e.stopPropagation();
255
- }
256
-
257
- ['dragenter', 'dragover'].forEach(eventName => {
258
- dropZone.addEventListener(eventName, highlight, false);
259
- });
260
-
261
- ['dragleave', 'drop'].forEach(eventName => {
262
- dropZone.addEventListener(eventName, unhighlight, false);
263
- });
264
-
265
- function highlight(e) {
266
- dropZone.classList.add('border-blue-400');
267
- }
268
-
269
- function unhighlight(e) {
270
- dropZone.classList.remove('border-blue-400');
271
- }
272
-
273
- dropZone.addEventListener('drop', handleDrop, false);
274
-
275
- function handleDrop(e) {
276
- const dt = e.dataTransfer;
277
- const files = dt.files;
278
-
279
- if (files.length) {
280
- imageInput.files = files;
281
- const file = files[0];
282
- const reader = new FileReader();
283
- reader.onload = function(e) {
284
- previewImage.src = e.target.result;
285
- imagePreview.classList.remove('hidden');
286
- }
287
- reader.readAsDataURL(file);
288
- }
289
- }
290
-
291
- form.addEventListener('submit', async (event) => {
292
- event.preventDefault();
293
- const file = imageInput.files[0];
294
- if (!file) {
295
- alert('Veuillez sélectionner une image.');
296
- return;
297
- }
298
-
299
- startTimer();
300
-
301
- loader.classList.remove('hidden');
302
- solutionDiv.classList.add('hidden');
303
- thoughtsContent.innerHTML = '';
304
- answerContent.innerHTML = '';
305
- thoughtsBox.classList.add('open');
306
-
307
- const formData = new FormData();
308
- formData.append('image', file);
309
-
310
- try {
311
- let currentMode = null;
312
- const response = await fetch('/solve', {
313
- method: 'POST',
314
- body: formData
315
- });
316
-
317
- const reader = response.body.getReader();
318
- const decoder = new TextDecoder();
319
- let buffer = '';
320
-
321
- while (true) {
322
- const { done, value } = await reader.read();
323
- if (done) {
324
- stopTimer();
325
- break;
326
- }
327
-
328
- buffer += decoder.decode(value, { stream: true });
329
- let eolIndex;
330
-
331
- while ((eolIndex = buffer.indexOf('\n\n')) >= 0) {
332
- const line = buffer.slice(0, eolIndex).trim();
333
- buffer = buffer.slice(eolIndex + 2);
334
-
335
- if (line.startsWith('data:')) {
336
- const data = JSON.parse(line.slice(5));
337
-
338
- if (data.mode) {
339
- currentMode = data.mode;
340
- loader.classList.add('hidden');
341
- solutionDiv.classList.remove('hidden');
342
- }
343
-
344
- if (data.content) {
345
- const content = data.content;
346
- if (currentMode === 'thinking') {
347
- thoughtsContent.innerHTML += `<p>${content}</p>`;
348
- thoughtsContent.scrollTop = thoughtsContent.scrollHeight;
349
- } else if (currentMode === 'answering') {
350
- answerContent.innerHTML += content;
351
- if (window.MathJax) {
352
- MathJax.typesetPromise([answerContent]).catch((err) => console.log('MathJax error:', err));
353
- }
354
- }
355
- }
356
- }
357
- }
358
- }
359
-
360
- } catch (error) {
361
- console.error('Erreur:', error);
362
- alert('Une erreur est survenue lors du traitement de la requête.');
363
- loader.classList.add('hidden');
364
- stopTimer();
365
- }
366
- });
367
- });
368
- </script>
369
- </body>
370
- </html>