Update index.html
Browse files- index.html +99 -17
index.html
CHANGED
|
@@ -1,19 +1,101 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>COVID-19 Data Prediction</title>
|
| 7 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<div class="container mt-5">
|
| 12 |
+
<h1 class="mb-4">COVID-19 Data Prediction</h1>
|
| 13 |
+
<p>Enter the text to predict:</p>
|
| 14 |
+
<input type="text" id="textInput" class="form-control mb-3" placeholder="Text to predict">
|
| 15 |
+
<button id="predictBtn" class="btn btn-primary">Predict</button>
|
| 16 |
+
</div>
|
| 17 |
+
<div class="container mt-4" id="resultContainer" style="display: none;">
|
| 18 |
+
<h2>Prediction Result</h2>
|
| 19 |
+
<table class="table table-bordered">
|
| 20 |
+
<thead>
|
| 21 |
+
<tr>
|
| 22 |
+
<th>Key</th>
|
| 23 |
+
<th>Value</th>
|
| 24 |
+
</tr>
|
| 25 |
+
</thead>
|
| 26 |
+
<tbody id="predictionTableBody">
|
| 27 |
+
</tbody>
|
| 28 |
+
</table>
|
| 29 |
+
<button id="showMapBtn" class="btn btn-primary">Show Map</button>
|
| 30 |
+
<div id="map" class="mt-3" style="width: 100%; height: 400px;"></div>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
| 34 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
|
| 35 |
+
<script>
|
| 36 |
+
$(document).ready(function() {
|
| 37 |
+
var map = null;
|
| 38 |
+
var predictionResult = null;
|
| 39 |
+
|
| 40 |
+
$("#predictBtn").click(function() {
|
| 41 |
+
var inputText = $("#textInput").val();
|
| 42 |
+
var apiUrl = "https://docfile-covid-19.hf.space/run/predict";
|
| 43 |
+
var requestBody = {
|
| 44 |
+
data: [inputText]
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
$.ajax({
|
| 48 |
+
type: "POST",
|
| 49 |
+
url: apiUrl,
|
| 50 |
+
headers: { "Content-Type": "application/json" },
|
| 51 |
+
data: JSON.stringify(requestBody),
|
| 52 |
+
success: function(response) {
|
| 53 |
+
predictionResult = response.data[0];
|
| 54 |
+
var translationMap = {
|
| 55 |
+
"country": "Pays",
|
| 56 |
+
"confirmed": "Confirmé",
|
| 57 |
+
"active": "Actif",
|
| 58 |
+
"deaths": "Décès",
|
| 59 |
+
"recovered": "Guéris",
|
| 60 |
+
"latitude": "Latitude",
|
| 61 |
+
"longitude": "Longitude"
|
| 62 |
+
// Ajoutez d'autres traductions si nécessaire
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
var predictionTable = "";
|
| 66 |
+
|
| 67 |
+
for (var key in predictionResult) {
|
| 68 |
+
var translatedKey = translationMap[key] || key;
|
| 69 |
+
var value = predictionResult[key] === null ? "Aucun" : predictionResult[key];
|
| 70 |
+
predictionTable += "<tr><td>" + translatedKey + "</td><td>" + value + "</td></tr>";
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
$("#predictionTableBody").html(predictionTable);
|
| 74 |
+
$("#resultContainer").show();
|
| 75 |
+
},
|
| 76 |
+
error: function(error) {
|
| 77 |
+
console.error("Prediction error:", error);
|
| 78 |
+
}
|
| 79 |
+
});
|
| 80 |
+
});
|
| 81 |
+
|
| 82 |
+
$("#showMapBtn").click(function() {
|
| 83 |
+
if (map === null && predictionResult !== null) {
|
| 84 |
+
var latitude = parseFloat(predictionResult.latitude);
|
| 85 |
+
var longitude = parseFloat(predictionResult.longitude);
|
| 86 |
+
|
| 87 |
+
map = L.map('map').setView([latitude, longitude], 10);
|
| 88 |
+
|
| 89 |
+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 90 |
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 91 |
+
}).addTo(map);
|
| 92 |
+
|
| 93 |
+
L.marker([latitude, longitude]).addTo(map)
|
| 94 |
+
.bindPopup('Latitude: ' + latitude + '<br>Longitude: ' + longitude)
|
| 95 |
+
.openPopup();
|
| 96 |
+
}
|
| 97 |
+
});
|
| 98 |
+
});
|
| 99 |
+
</script>
|
| 100 |
+
</body>
|
| 101 |
</html>
|