Spaces:
Sleeping
Sleeping
update
Browse files- static/index.html +21 -9
static/index.html
CHANGED
@@ -118,15 +118,27 @@
|
|
118 |
}
|
119 |
|
120 |
function updateTable(results) {
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
function updateChart(results) {
|
131 |
const ctx = document.getElementById('resultsChart').getContext('2d');
|
132 |
if (chartInstance) chartInstance.destroy();
|
|
|
118 |
}
|
119 |
|
120 |
function updateTable(results) {
|
121 |
+
const tbody = document.querySelector('#results-table tbody');
|
122 |
+
tbody.innerHTML = '';
|
123 |
+
|
124 |
+
// If labels is a single string, split it manually based on the input
|
125 |
+
let labelsArray = [];
|
126 |
+
if (typeof results.labels === 'string') {
|
127 |
+
labelsArray = results.labels.split(',').map(label => label.trim());
|
128 |
+
} else {
|
129 |
+
labelsArray = results.labels; // Use the original array if it's already split
|
130 |
+
}
|
131 |
+
|
132 |
+
// Use the first score (since the model returns one score for all labels)
|
133 |
+
const score = results.scores.length > 0 ? results.scores[0].toFixed(3) : '0.000';
|
134 |
+
|
135 |
+
// Create a row for each label with the same score
|
136 |
+
labelsArray.forEach((label) => {
|
137 |
+
const row = document.createElement('tr');
|
138 |
+
row.innerHTML = `<td>${label}</td><td>${score}</td>`;
|
139 |
+
tbody.appendChild(row);
|
140 |
+
});
|
141 |
+
}
|
142 |
function updateChart(results) {
|
143 |
const ctx = document.getElementById('resultsChart').getContext('2d');
|
144 |
if (chartInstance) chartInstance.destroy();
|