Grets commited on
Commit
5044c19
·
verified ·
1 Parent(s): ad051e1

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +37 -30
index.html CHANGED
@@ -244,36 +244,43 @@
244
  const y = document.getElementById('year');
245
  if (y) y.textContent = new Date().getFullYear();
246
 
247
- // Leaderboard: try to fetch metrics_by_engine.json if present; else fall back to inline JSON
248
- (async function renderLeaderboard(){
249
- const el = document.getElementById('leaderboard-body');
250
- const inline = document.getElementById('leaderboard-data');
251
- if (!el) return;
252
- let rows;
253
- try {
254
- const res = await fetch('metrics_by_engine.json', {cache:'no-store'});
255
- if (res.ok) {
256
- const metrics = await res.json();
257
- // Expecting the AV summary per engine; create a toy score = avg of task accuracies if you provide them.
258
- // This block is intentionally lightweight – adapt to your file format as needed.
259
- if (metrics && metrics.leaderboard) {
260
- rows = metrics.leaderboard;
261
- }
262
- }
263
- } catch(e){ /* ignore and use inline */ }
264
- if (!rows) {
265
- try { rows = JSON.parse(inline.textContent.trim()).rows; } catch(e){ rows = []; }
266
- }
267
- rows.sort((a,b) => a.rank - b.rank);
268
- el.innerHTML = rows.map(r => `
269
- <tr>
270
- <td>${r.Model}</td>
271
- <td>${r.Modality}</td>
272
- <td>${r.Top1AccuracyinPercent}</td>
273
- <td>${r.Top1AccuracyinPercent}</td>
274
- <td>${r.N}</td>
275
- </tr>`).join('');
276
- })();
 
 
 
 
 
 
 
277
 
278
  // Example video version toggles
279
  const video = document.getElementById('sampleVideo');
 
244
  const y = document.getElementById('year');
245
  if (y) y.textContent = new Date().getFullYear();
246
 
247
+ <script>
248
+ // Leaderboard: rendert NUR deine inline JSON-rows
249
+ (function renderLeaderboard(){
250
+ const el = document.getElementById('leaderboard-body');
251
+ const dataEl = document.getElementById('leaderboard-data');
252
+ if (!el || !dataEl) return;
253
+
254
+ // JSON aus dem <script id="leaderboard-data"> holen
255
+ let rows = [];
256
+ try {
257
+ const parsed = JSON.parse(dataEl.textContent.trim());
258
+ rows = Array.isArray(parsed.rows) ? parsed.rows : [];
259
+ } catch (_) {}
260
+
261
+ // Sortierung: erst Model, dann Modality in Reihenfolge AV, V, A
262
+ const order = ['AV', 'V', 'A'];
263
+ rows.sort((a, b) =>
264
+ String(a.model).localeCompare(String(b.model)) ||
265
+ order.indexOf(a.modality) - order.indexOf(b.modality)
266
+ );
267
+
268
+ const today = new Date().toISOString().slice(0,10);
269
+ const fmtPct = v => (v==null || v==='') ? '—' : (Number(v).toFixed(1) + '%');
270
+
271
+ el.innerHTML = rows.map(r => `
272
+ <tr>
273
+ <td>${r.model}</td>
274
+ <td>${r.modality}</td>
275
+ <td>${fmtPct(r.Top1AccuracyinPercent)}</td>
276
+ <td>${fmtPct(r.Top5AccuracyinPercent)}</td>
277
+ <td>${r.N ?? '—'}</td>
278
+ <td>${r.updated ?? today}</td>
279
+ </tr>
280
+ `).join('');
281
+ })();
282
+ </script>
283
+
284
 
285
  // Example video version toggles
286
  const video = document.getElementById('sampleVideo');