Upload folder using huggingface_hub
Browse files- templates/index.html +23 -8
templates/index.html
CHANGED
|
@@ -15,19 +15,34 @@
|
|
| 15 |
<input type="number" id="year" placeholder="Enter Year (e.g. 2026)" value="2026">
|
| 16 |
<br>
|
| 17 |
<button onclick="runTechModal()">START PREDICTION</button>
|
| 18 |
-
<div id="results" style="margin-top: 20px;"></div>
|
| 19 |
</div>
|
| 20 |
|
| 21 |
<script>
|
| 22 |
async function runTechModal() {
|
| 23 |
const year = document.getElementById('year').value;
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
</script>
|
| 33 |
</body>
|
|
|
|
| 15 |
<input type="number" id="year" placeholder="Enter Year (e.g. 2026)" value="2026">
|
| 16 |
<br>
|
| 17 |
<button onclick="runTechModal()">START PREDICTION</button>
|
| 18 |
+
<div id="results" style="margin-top: 20px; text-align: left; max-width: 300px;"></div>
|
| 19 |
</div>
|
| 20 |
|
| 21 |
<script>
|
| 22 |
async function runTechModal() {
|
| 23 |
const year = document.getElementById('year').value;
|
| 24 |
+
try {
|
| 25 |
+
const res = await fetch('/predict', {
|
| 26 |
+
method: 'POST',
|
| 27 |
+
headers: {'Content-Type': 'application/json'},
|
| 28 |
+
body: JSON.stringify({year: year})
|
| 29 |
+
});
|
| 30 |
+
const data = await res.json();
|
| 31 |
+
|
| 32 |
+
if (data.tech_scores) {
|
| 33 |
+
// Display all tech scores
|
| 34 |
+
let resultsHtml = '<h3>Tech Scores:</h3>';
|
| 35 |
+
Object.entries(data.tech_scores).forEach(([category, score]) => {
|
| 36 |
+
resultsHtml += `<div>${category}: ${(score || 0).toFixed(4)}</div>`;
|
| 37 |
+
});
|
| 38 |
+
resultsHtml += `<div style="margin-top: 10px;">Status: ${data.status}</div>`;
|
| 39 |
+
document.getElementById('results').innerHTML = resultsHtml;
|
| 40 |
+
} else {
|
| 41 |
+
document.getElementById('results').innerText = `Error: Unexpected response format`;
|
| 42 |
+
}
|
| 43 |
+
} catch (error) {
|
| 44 |
+
document.getElementById('results').innerText = `Error: ${error.message}`;
|
| 45 |
+
}
|
| 46 |
}
|
| 47 |
</script>
|
| 48 |
</body>
|