Spaces:
Running
Running
Update index.html
Browse files- index.html +20 -5
index.html
CHANGED
@@ -155,10 +155,25 @@
|
|
155 |
const headers = rows.shift();
|
156 |
return { headers, rows };
|
157 |
}
|
158 |
-
async function
|
159 |
-
const
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
const metricFilter = document.getElementById('metricFilter');
|
164 |
const table = document.getElementById('csvTable');
|
@@ -255,7 +270,7 @@
|
|
255 |
populateTable(parsedCSV.headers, parsedCSV.rows, filterValue, 0);
|
256 |
});
|
257 |
let parsedCSV;
|
258 |
-
|
259 |
parsedCSV = { headers, rows };
|
260 |
populateFilterOptions(rows, 0);
|
261 |
populateTable(headers, rows, '', 0);
|
|
|
155 |
const headers = rows.shift();
|
156 |
return { headers, rows };
|
157 |
}
|
158 |
+
async function loadCSVFromHuggingFace(dataset, filename, token) {
|
159 |
+
const url = `https://huggingface.co/datasets/${dataset}/resolve/main/${filename}`;
|
160 |
+
|
161 |
+
const response = await fetch(url, {
|
162 |
+
headers: {
|
163 |
+
'Authorization': `Bearer ${token}`,
|
164 |
+
},
|
165 |
+
});
|
166 |
+
|
167 |
+
if (!response.ok) {
|
168 |
+
throw new Error(`Failed to fetch file: ${response.statusText}`);
|
169 |
+
}
|
170 |
+
|
171 |
+
const text = await response.text();
|
172 |
+
|
173 |
+
const rows = text.split('\n').map(row => row.split(','));
|
174 |
+
const headers = rows.shift(); // Assume first row contains headers
|
175 |
+
|
176 |
+
return { headers, rows };
|
177 |
}
|
178 |
const metricFilter = document.getElementById('metricFilter');
|
179 |
const table = document.getElementById('csvTable');
|
|
|
270 |
populateTable(parsedCSV.headers, parsedCSV.rows, filterValue, 0);
|
271 |
});
|
272 |
let parsedCSV;
|
273 |
+
loadCSVFromHuggingFace('UlrickBL/benchmark_overview', 'benchmark_overview_data.csv', window.huggingface.variables.HF_TOKEN).then(({ headers, rows }) => {
|
274 |
parsedCSV = { headers, rows };
|
275 |
populateFilterOptions(rows, 0);
|
276 |
populateTable(headers, rows, '', 0);
|