LeenAlQadi commited on
Commit
fe0ba8c
·
1 Parent(s): 3638b8c

fixed average col

Browse files
Files changed (1) hide show
  1. frontend/leaderboard.html +78 -29
frontend/leaderboard.html CHANGED
@@ -195,6 +195,11 @@
195
  left: var(--sticky-avg-left, 620px) !important;
196
  z-index: 28 !important;
197
  box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
 
 
 
 
 
198
  }
199
 
200
  .dark #table-wrapper table.gridjs-table thead th:nth-child(1),
@@ -212,27 +217,44 @@
212
  position: sticky !important;
213
  left: var(--sticky-avg-left, 620px) !important;
214
  z-index: 30 !important;
215
- box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
 
 
 
 
 
216
  }
217
 
218
  #table-wrapper .gridjs-th.avg-col-header {
219
- background: #f1f5f9 !important;
220
  z-index: 39 !important;
221
  top: 0 !important;
222
  }
223
 
224
- #table-wrapper .gridjs-td.avg-col-header {
225
- background: #fff !important;
226
- }
227
-
228
  .dark #table-wrapper .gridjs-th.avg-col-header {
229
- background: #0f172a !important;
230
- box-shadow: 1px 0 0 rgba(71, 85, 105, 0.6);
231
  }
232
 
233
  .dark #table-wrapper .gridjs-td.avg-col-header {
234
- background: #1e293b !important;
235
- box-shadow: 1px 0 0 rgba(71, 85, 105, 0.6);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
 
238
  .dark .gridjs-head,
@@ -269,7 +291,12 @@
269
  th.gridjs-th,
270
  td.gridjs-td {
271
  border-left: none !important;
272
- border-right: none !important;
 
 
 
 
 
273
  }
274
 
275
  .line-clamp-2-custom {
@@ -630,11 +657,6 @@
630
  </div>
631
  </div>
632
 
633
- <!-- Precision -->
634
- <div>
635
- <label class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Precision</label>
636
- <div class="grid grid-cols-2 sm:grid-cols-3 gap-3" id="precisionFilterContainer"></div>
637
- </div>
638
 
639
  <!-- Type & License -->
640
  <div
@@ -885,9 +907,6 @@
885
  class="w-3.5 h-3.5"></i> <span id="modalLicense">--</span></span>
886
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
887
 
888
- <span class="flex items-center gap-1" title="Precision"><i data-lucide="cpu"
889
- class="w-3.5 h-3.5"></i> <span id="modalPrecision">--</span></span>
890
- <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
891
 
892
  <!-- <span class="flex items-center gap-1" title="Revision"><i data-lucide="git-commit"
893
  class="w-3.5 h-3.5"></i> <span id="modalRevision" class="font-mono">--</span></span> -->
@@ -1481,8 +1500,6 @@
1481
  // We don't have an ID for downloads yet in the static HTML, so we rely on the injected HTML below
1482
  const modalLicenseEl = $('#modalLicense');
1483
  if (modalLicenseEl) modalLicenseEl.innerText = asUnknown(model["License"]);
1484
- const modalPrecisionEl = $('#modalPrecision');
1485
- if (modalPrecisionEl) modalPrecisionEl.innerText = asUnknown(model["Precision"]);
1486
  const modalRevisionEl = $('#modalRevision');
1487
  if (modalRevisionEl) modalRevisionEl.innerText = revision;
1488
 
@@ -1492,8 +1509,6 @@
1492
  <span class="flex items-center gap-1" title="License"><i data-lucide="scale" class="w-3.5 h-3.5"></i> <span id="modalLicense">${asUnknown(model["License"])}</span></span>
1493
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
1494
 
1495
- <span class="flex items-center gap-1" title="Precision"><i data-lucide="cpu" class="w-3.5 h-3.5"></i> <span id="modalPrecision">${asUnknown(model["Precision"])}</span></span>
1496
- <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
1497
 
1498
  <span class="flex items-center gap-1" title="Revision"><i data-lucide="git-commit" class="w-3.5 h-3.5"></i> <span id="modalRevision" class="font-mono">${revision}</span></span>
1499
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
@@ -1660,6 +1675,28 @@
1660
  return true;
1661
  }
1662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1663
  function initGradientScroll() {
1664
  const wrapper = $('#table-wrapper');
1665
  const outer = $('#table-outer');
@@ -1669,6 +1706,7 @@
1669
  const ratio = max > 0 ? wrapper.scrollTop / max : 0;
1670
  outer.style.setProperty('--green-opacity', (0.07 * (1 - ratio)).toFixed(3));
1671
  outer.style.setProperty('--red-opacity', (0.07 * ratio).toFixed(3));
 
1672
  }, { passive: true });
1673
  }
1674
 
@@ -1676,7 +1714,14 @@
1676
  let attempts = 0;
1677
  const run = () => {
1678
  const ok = applyStickyModelNameColumn();
1679
- if (ok || attempts >= retries) return;
 
 
 
 
 
 
 
1680
  attempts += 1;
1681
  setTimeout(() => requestAnimationFrame(run), 40);
1682
  };
@@ -1690,7 +1735,7 @@
1690
  const maxSz = (parseInt($('#maxSizeSlider').value) === maxMeta) ? 99999 : parseInt($('#maxSizeSlider').value);
1691
 
1692
  const getVals = cls => $$(`.${cls}:checked`).map(c => c.value);
1693
- const [precs, types, lics] = [getVals('precision-chk'), getVals('type-chk'), getVals('license-chk')];
1694
 
1695
  // 1. Filter Data
1696
  let filtered = lbData.filter(r =>
@@ -1700,7 +1745,7 @@
1700
  const sizeValue = s === null ? 0 : s;
1701
  return sizeValue >= minSz && sizeValue <= maxSz;
1702
  })() &&
1703
- (!precs.length || precs.includes(r["Precision"])) &&
1704
  (!types.length || types.includes(r["Full Type"])) &&
1705
  (!lics.length || lics.includes(r["License"]))
1706
  ).map(row => ({ ...row }));
@@ -1773,7 +1818,7 @@
1773
 
1774
  tableColumns = keys.map(key => {
1775
  const isScore = EVAL_COLUMNS.includes(key), isAvg = key.includes("Average");
1776
- let name = key;
1777
  let icon = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="lucide lucide-chevrons-up-down"><path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/></svg>`;
1778
  let cls = "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300";
1779
 
@@ -1851,6 +1896,11 @@
1851
 
1852
  def.formatter = (c, r) => {
1853
  const modelName = (modelNameIdx > -1 && r.cells[modelNameIdx]) ? r.cells[modelNameIdx].data : "";
 
 
 
 
 
1854
  return shouldUseBar ? renderBar(c, modelName, key) : renderRaw(c, modelName, key);
1855
  };
1856
 
@@ -1911,7 +1961,6 @@
1911
  : `<label class="inline-flex items-center p-2 border border-slate-200 dark:border-slate-600 rounded-md bg-slate-50 dark:bg-slate-700 hover:bg-white transition cursor-pointer"><input type="checkbox" value="${v}" class="${cls} form-checkbox h-4 w-4 text-indigo-600 rounded" checked onchange="window.applyFilters()"><span class="ml-2 text-xs font-medium text-slate-700 dark:text-slate-200">${v}</span></label>`
1912
  ).join('');
1913
  };
1914
- createInputs('#precisionFilterContainer', 'Precision', 'precision-chk', 'box');
1915
  createInputs('#typeFilterContainer', 'Full Type', 'type-chk', 'pill');
1916
  createInputs('#licenseFilterContainer', 'License', 'license-chk', 'pill');
1917
  }
@@ -1919,7 +1968,7 @@
1919
  function buildColMenuDOM() {
1920
  const addBtns = (grp, el) => {
1921
  $(el).innerHTML = '';
1922
- tableColumns.filter(c => c.group === grp && !["_link", "T", "Type", "Full Type"].includes(c.id)).forEach(c => {
1923
  const b = document.createElement('button');
1924
  b.innerText = c.id.includes("Average") ? "Average" : (c.id === "Model Size Filter" ? "Params" : c.id);
1925
  b.className = `px-2 py-1 text-xs font-medium rounded-md border transition-all select-none ${!c.hidden ? "bg-indigo-600 text-white border-indigo-600" : "bg-white text-slate-600 border-slate-200 dark:bg-slate-700 dark:border-slate-600 dark:text-slate-300"}`;
 
195
  left: var(--sticky-avg-left, 620px) !important;
196
  z-index: 28 !important;
197
  box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
198
+ font-weight: 700 !important;
199
+ }
200
+
201
+ #table-wrapper table.gridjs-table tbody td:nth-child(3) * {
202
+ font-weight: 700 !important;
203
  }
204
 
205
  .dark #table-wrapper table.gridjs-table thead th:nth-child(1),
 
217
  position: sticky !important;
218
  left: var(--sticky-avg-left, 620px) !important;
219
  z-index: 30 !important;
220
+ background: #ffffff !important;
221
+ font-weight: 700 !important;
222
+ }
223
+
224
+ #table-wrapper .gridjs-td.avg-col-header * {
225
+ font-weight: 700 !important;
226
  }
227
 
228
  #table-wrapper .gridjs-th.avg-col-header {
229
+ background: #f8faff !important;
230
  z-index: 39 !important;
231
  top: 0 !important;
232
  }
233
 
 
 
 
 
234
  .dark #table-wrapper .gridjs-th.avg-col-header {
235
+ background: #1e2235 !important;
 
236
  }
237
 
238
  .dark #table-wrapper .gridjs-td.avg-col-header {
239
+ background: #222639 !important;
240
+ }
241
+
242
+ #avg-col-highlight {
243
+ position: absolute;
244
+ top: 0;
245
+ pointer-events: none;
246
+ z-index: 2;
247
+ border-radius: 6px;
248
+ background: transparent;
249
+ border-left: 1px solid rgba(100, 116, 139, 0.25);
250
+ border-right: 1px solid rgba(100, 116, 139, 0.25);
251
+ box-shadow: -2px 0 8px rgba(0,0,0,0.07), 2px 0 8px rgba(0,0,0,0.07);
252
+ }
253
+
254
+ .dark #avg-col-highlight {
255
+ border-left: 1px solid rgba(148, 163, 184, 0.2);
256
+ border-right: 1px solid rgba(148, 163, 184, 0.2);
257
+ box-shadow: -2px 0 10px rgba(0,0,0,0.25), 2px 0 10px rgba(0,0,0,0.25);
258
  }
259
 
260
  .dark .gridjs-head,
 
291
  th.gridjs-th,
292
  td.gridjs-td {
293
  border-left: none !important;
294
+ border-right: 1px solid rgba(148, 163, 184, 0.15) !important;
295
+ }
296
+
297
+ .dark th.gridjs-th,
298
+ .dark td.gridjs-td {
299
+ border-right: 1px solid rgba(148, 163, 184, 0.12) !important;
300
  }
301
 
302
  .line-clamp-2-custom {
 
657
  </div>
658
  </div>
659
 
 
 
 
 
 
660
 
661
  <!-- Type & License -->
662
  <div
 
907
  class="w-3.5 h-3.5"></i> <span id="modalLicense">--</span></span>
908
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
909
 
 
 
 
910
 
911
  <!-- <span class="flex items-center gap-1" title="Revision"><i data-lucide="git-commit"
912
  class="w-3.5 h-3.5"></i> <span id="modalRevision" class="font-mono">--</span></span> -->
 
1500
  // We don't have an ID for downloads yet in the static HTML, so we rely on the injected HTML below
1501
  const modalLicenseEl = $('#modalLicense');
1502
  if (modalLicenseEl) modalLicenseEl.innerText = asUnknown(model["License"]);
 
 
1503
  const modalRevisionEl = $('#modalRevision');
1504
  if (modalRevisionEl) modalRevisionEl.innerText = revision;
1505
 
 
1509
  <span class="flex items-center gap-1" title="License"><i data-lucide="scale" class="w-3.5 h-3.5"></i> <span id="modalLicense">${asUnknown(model["License"])}</span></span>
1510
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
1511
 
 
 
1512
 
1513
  <span class="flex items-center gap-1" title="Revision"><i data-lucide="git-commit" class="w-3.5 h-3.5"></i> <span id="modalRevision" class="font-mono">${revision}</span></span>
1514
  <span class="w-1 h-1 rounded-full bg-slate-300 dark:bg-slate-600"></span>
 
1675
  return true;
1676
  }
1677
 
1678
+ function updateAvgColHighlight() {
1679
+ const wrapper = $('#table-wrapper');
1680
+ const outer = $('#table-outer');
1681
+ if (!wrapper || !outer) return;
1682
+ const th = wrapper.querySelector('th.avg-col-header');
1683
+ if (!th) return;
1684
+
1685
+ let highlight = $('#avg-col-highlight');
1686
+ if (!highlight) {
1687
+ highlight = document.createElement('div');
1688
+ highlight.id = 'avg-col-highlight';
1689
+ outer.appendChild(highlight);
1690
+ }
1691
+
1692
+ const outerRect = outer.getBoundingClientRect();
1693
+ const thRect = th.getBoundingClientRect();
1694
+
1695
+ highlight.style.left = `${thRect.left - outerRect.left}px`;
1696
+ highlight.style.width = `${thRect.width}px`;
1697
+ highlight.style.height = `${outer.offsetHeight}px`;
1698
+ }
1699
+
1700
  function initGradientScroll() {
1701
  const wrapper = $('#table-wrapper');
1702
  const outer = $('#table-outer');
 
1706
  const ratio = max > 0 ? wrapper.scrollTop / max : 0;
1707
  outer.style.setProperty('--green-opacity', (0.07 * (1 - ratio)).toFixed(3));
1708
  outer.style.setProperty('--red-opacity', (0.07 * ratio).toFixed(3));
1709
+ updateAvgColHighlight();
1710
  }, { passive: true });
1711
  }
1712
 
 
1714
  let attempts = 0;
1715
  const run = () => {
1716
  const ok = applyStickyModelNameColumn();
1717
+ if (ok) {
1718
+ updateAvgColHighlight();
1719
+ // Re-run after layout settles to fix first-load position
1720
+ setTimeout(() => requestAnimationFrame(updateAvgColHighlight), 100);
1721
+ setTimeout(() => requestAnimationFrame(updateAvgColHighlight), 400);
1722
+ return;
1723
+ }
1724
+ if (attempts >= retries) return;
1725
  attempts += 1;
1726
  setTimeout(() => requestAnimationFrame(run), 40);
1727
  };
 
1735
  const maxSz = (parseInt($('#maxSizeSlider').value) === maxMeta) ? 99999 : parseInt($('#maxSizeSlider').value);
1736
 
1737
  const getVals = cls => $$(`.${cls}:checked`).map(c => c.value);
1738
+ const [types, lics] = [getVals('type-chk'), getVals('license-chk')];
1739
 
1740
  // 1. Filter Data
1741
  let filtered = lbData.filter(r =>
 
1745
  const sizeValue = s === null ? 0 : s;
1746
  return sizeValue >= minSz && sizeValue <= maxSz;
1747
  })() &&
1748
+
1749
  (!types.length || types.includes(r["Full Type"])) &&
1750
  (!lics.length || lics.includes(r["License"]))
1751
  ).map(row => ({ ...row }));
 
1818
 
1819
  tableColumns = keys.map(key => {
1820
  const isScore = EVAL_COLUMNS.includes(key), isAvg = key.includes("Average");
1821
+ let name = isAvg ? key.toUpperCase() : key;
1822
  let icon = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="lucide lucide-chevrons-up-down"><path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/></svg>`;
1823
  let cls = "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300";
1824
 
 
1896
 
1897
  def.formatter = (c, r) => {
1898
  const modelName = (modelNameIdx > -1 && r.cells[modelNameIdx]) ? r.cells[modelNameIdx].data : "";
1899
+ if (isAvg) {
1900
+ const n = parseFloat(c); if (isNaN(n)) return c;
1901
+ const h = (Math.max(0, Math.min(100, n)) / 100) * 120;
1902
+ return gridjs.html(`<div class="flex justify-center"><div style="background: linear-gradient(to right, hsla(${h},100%,45%,0.55) ${n}%, hsla(${h},100%,45%,0.07) ${n}%); border: 1.5px solid hsla(${h},90%,40%,0.65);" class="w-24 py-1 rounded-md text-center text-xs font-bold text-slate-700 dark:text-slate-200 shadow-sm">${n.toFixed(2)}<span class="text-[10px] font-normal opacity-70 ml-0.5">%</span></div></div>`);
1903
+ }
1904
  return shouldUseBar ? renderBar(c, modelName, key) : renderRaw(c, modelName, key);
1905
  };
1906
 
 
1961
  : `<label class="inline-flex items-center p-2 border border-slate-200 dark:border-slate-600 rounded-md bg-slate-50 dark:bg-slate-700 hover:bg-white transition cursor-pointer"><input type="checkbox" value="${v}" class="${cls} form-checkbox h-4 w-4 text-indigo-600 rounded" checked onchange="window.applyFilters()"><span class="ml-2 text-xs font-medium text-slate-700 dark:text-slate-200">${v}</span></label>`
1962
  ).join('');
1963
  };
 
1964
  createInputs('#typeFilterContainer', 'Full Type', 'type-chk', 'pill');
1965
  createInputs('#licenseFilterContainer', 'License', 'license-chk', 'pill');
1966
  }
 
1968
  function buildColMenuDOM() {
1969
  const addBtns = (grp, el) => {
1970
  $(el).innerHTML = '';
1971
+ tableColumns.filter(c => c.group === grp && !["_link", "T", "Type", "Full Type", "Precision"].includes(c.id)).forEach(c => {
1972
  const b = document.createElement('button');
1973
  b.innerText = c.id.includes("Average") ? "Average" : (c.id === "Model Size Filter" ? "Params" : c.id);
1974
  b.className = `px-2 py-1 text-xs font-medium rounded-md border transition-all select-none ${!c.hidden ? "bg-indigo-600 text-white border-indigo-600" : "bg-white text-slate-600 border-slate-200 dark:bg-slate-700 dark:border-slate-600 dark:text-slate-300"}`;