Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
50 lines (41 loc) · 1.66 KB
/
Copy pathindex.html
File metadata and controls
50 lines (41 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prédiction Données Entreprise</title>
</head>
<body>
<h1>Prédiction Données Excel</h1>
<input type="file" id="csvInput" accept=".csv">
<button onclick="uploadCsv()">Prédire</button>
<div id="results"></div>
<script>
async function uploadCsv() {
const fileInput = document.getElementById('csvInput');
const resultsDiv = document.getElementById('results');
if (!fileInput.files[0]) {
alert("Sélectionnez un fichier Excel");
return;
}
const formData = new FormData();
formData.append('file', fileInput.files[0]);
try {
resultsDiv.innerHTML = "Traitement en cours...";
const response = await fetch('http://0.0.0.0:8000/predictCSV/', {
method: 'POST',
body: formData
});
const data = await response.json();
let html = `<h3>Résultats (${data.predictions.length} prédictions)</h3>`;
data.predictions.forEach(pred => {
html += `<p>Ligne ${pred.id} || ${pred.prediction} (confiance: ${(pred.confidence * 100).toFixed(1)}%) || ${pred.localite}:</p>`;
});
resultsDiv.innerHTML = html;
} catch(error) {
resultsDiv.innerHTML = "Erreur: " + error.message;
}
}
</script>
</body>
</html>