Create templates/index.html
Browse files- templates/index.html +86 -0
templates/index.html
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Analyse d'Image</title>
|
7 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
|
8 |
+
<style>
|
9 |
+
.container {
|
10 |
+
max-width: 800px;
|
11 |
+
margin: 0 auto;
|
12 |
+
padding: 20px;
|
13 |
+
}
|
14 |
+
.result-section {
|
15 |
+
margin-top: 20px;
|
16 |
+
padding: 15px;
|
17 |
+
border: 1px solid #ddd;
|
18 |
+
border-radius: 5px;
|
19 |
+
}
|
20 |
+
#loading {
|
21 |
+
display: none;
|
22 |
+
text-align: center;
|
23 |
+
margin: 20px 0;
|
24 |
+
}
|
25 |
+
</style>
|
26 |
+
</head>
|
27 |
+
<body>
|
28 |
+
<div class="container">
|
29 |
+
<h1>Analyse d'Image avec Gemini</h1>
|
30 |
+
|
31 |
+
<form id="uploadForm">
|
32 |
+
<input type="file" id="imageInput" accept="image/*" required>
|
33 |
+
<button type="submit">Analyser</button>
|
34 |
+
</form>
|
35 |
+
|
36 |
+
<div id="loading">Analyse en cours...</div>
|
37 |
+
|
38 |
+
<div class="result-section">
|
39 |
+
<h2>Tableau d'Analyse</h2>
|
40 |
+
<div id="tableauResult"></div>
|
41 |
+
</div>
|
42 |
+
|
43 |
+
<div class="result-section">
|
44 |
+
<h2>Dissertation</h2>
|
45 |
+
<div id="dissertationResult"></div>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
|
49 |
+
<script>
|
50 |
+
document.getElementById('uploadForm').addEventListener('submit', async (e) => {
|
51 |
+
e.preventDefault();
|
52 |
+
|
53 |
+
const loading = document.getElementById('loading');
|
54 |
+
const tableauResult = document.getElementById('tableauResult');
|
55 |
+
const dissertationResult = document.getElementById('dissertationResult');
|
56 |
+
|
57 |
+
const formData = new FormData();
|
58 |
+
formData.append('image', document.getElementById('imageInput').files[0]);
|
59 |
+
|
60 |
+
loading.style.display = 'block';
|
61 |
+
tableauResult.innerHTML = '';
|
62 |
+
dissertationResult.innerHTML = '';
|
63 |
+
|
64 |
+
try {
|
65 |
+
const response = await fetch('/analyze', {
|
66 |
+
method: 'POST',
|
67 |
+
body: formData
|
68 |
+
});
|
69 |
+
|
70 |
+
const data = await response.json();
|
71 |
+
|
72 |
+
if (response.ok) {
|
73 |
+
tableauResult.innerHTML = marked.parse(data.tableau);
|
74 |
+
dissertationResult.innerHTML = marked.parse(data.dissertation);
|
75 |
+
} else {
|
76 |
+
alert('Erreur: ' + data.error);
|
77 |
+
}
|
78 |
+
} catch (error) {
|
79 |
+
alert('Erreur lors de l\'analyse: ' + error);
|
80 |
+
} finally {
|
81 |
+
loading.style.display = 'none';
|
82 |
+
}
|
83 |
+
});
|
84 |
+
</script>
|
85 |
+
</body>
|
86 |
+
</html>
|