Michael Rabinovich Cursor commited on
Commit ·
461547b
1
Parent(s): 5140b0a
leaderboard: rename tabs, relabel fixtures as samples, inline gallery row stats
Browse files- Rename the visual "Gallery" tab to "Leaderboard" and the table tab to
"Detailed View" (order unchanged); update the smoke test accordingly.
- Replace user-facing "fixture" wording with "sample" across the gallery,
task browser, submit instructions, and submitter status/error messages.
Internal data keys, routes, CSS, and identifiers are unchanged.
- Drop the gallery's "more numbers" expander: surface Generation/Editing
inline under the aggregate score and move Download ZIP under the name.
- Link each gallery submission title to its hosted report (same
/reports/<id>.html the Detailed View table uses); drop the date line.
Co-authored-by: Cursor <cursoragent@cursor.com>
- app.py +6 -6
- gallery.py +38 -48
- submit.py +11 -11
- tasks.py +2 -2
- tests/test_smoke.py +6 -5
app.py
CHANGED
|
@@ -84,7 +84,7 @@ logging.basicConfig(
|
|
| 84 |
|
| 85 |
# Canonical policy doc lives in the code repo so contributors reading
|
| 86 |
# the GitHub repo see it without needing to visit the Space. Linked
|
| 87 |
-
# from both the
|
| 88 |
# the About tab.
|
| 89 |
VALIDATION_DOC_URL = (
|
| 90 |
"https://github.com/huggingface/cadgenbench/blob/main/docs/benchmark/validation.md"
|
|
@@ -774,7 +774,7 @@ with gr.Blocks(title="CADGenBench Leaderboard", theme=gr.themes.Soft()) as block
|
|
| 774 |
"_Benchmarking AI-driven CAD generation._"
|
| 775 |
)
|
| 776 |
|
| 777 |
-
with gr.Tab("
|
| 778 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|
| 779 |
# fixture picker, turntable grid, compare modal) is a
|
| 780 |
# self-contained HTML doc inlined into an iframe `srcdoc` so it
|
|
@@ -788,7 +788,7 @@ with gr.Blocks(title="CADGenBench Leaderboard", theme=gr.themes.Soft()) as block
|
|
| 788 |
fn=_gallery_iframe_html, outputs=gallery_html,
|
| 789 |
)
|
| 790 |
|
| 791 |
-
with gr.Tab("
|
| 792 |
# Load both tiers once at boot. `_safe_load_split` keeps a Hub
|
| 793 |
# read failure from crashing the Space: on failure the frames
|
| 794 |
# come up empty and `initial_error` carries the message the
|
|
@@ -882,9 +882,9 @@ with gr.Blocks(title="CADGenBench Leaderboard", theme=gr.themes.Soft()) as block
|
|
| 882 |
f"""
|
| 883 |
**Submission format.** A single zip with:
|
| 884 |
|
| 885 |
-
- one folder per
|
| 886 |
-
|
| 887 |
-
scores zero for that
|
| 888 |
- a top-level `meta.json`:
|
| 889 |
|
| 890 |
```json
|
|
|
|
| 84 |
|
| 85 |
# Canonical policy doc lives in the code repo so contributors reading
|
| 86 |
# the GitHub repo see it without needing to visit the Space. Linked
|
| 87 |
+
# from both the Detailed View tab's Validation Guidelines accordion and
|
| 88 |
# the About tab.
|
| 89 |
VALIDATION_DOC_URL = (
|
| 90 |
"https://github.com/huggingface/cadgenbench/blob/main/docs/benchmark/validation.md"
|
|
|
|
| 774 |
"_Benchmarking AI-driven CAD generation._"
|
| 775 |
)
|
| 776 |
|
| 777 |
+
with gr.Tab("Leaderboard"):
|
| 778 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|
| 779 |
# fixture picker, turntable grid, compare modal) is a
|
| 780 |
# self-contained HTML doc inlined into an iframe `srcdoc` so it
|
|
|
|
| 788 |
fn=_gallery_iframe_html, outputs=gallery_html,
|
| 789 |
)
|
| 790 |
|
| 791 |
+
with gr.Tab("Detailed View"):
|
| 792 |
# Load both tiers once at boot. `_safe_load_split` keeps a Hub
|
| 793 |
# read failure from crashing the Space: on failure the frames
|
| 794 |
# come up empty and `initial_error` carries the message the
|
|
|
|
| 882 |
f"""
|
| 883 |
**Submission format.** A single zip with:
|
| 884 |
|
| 885 |
+
- one folder per sample in `{HF_DATA_REPO}`; include `output.step` for
|
| 886 |
+
samples where your system produced a candidate. Missing `output.step`
|
| 887 |
+
scores zero for that sample;
|
| 888 |
- a top-level `meta.json`:
|
| 889 |
|
| 890 |
```json
|
gallery.py
CHANGED
|
@@ -46,6 +46,8 @@ from __future__ import annotations
|
|
| 46 |
|
| 47 |
import json
|
| 48 |
|
|
|
|
|
|
|
| 49 |
# Gallery shows the top-N verified submissions only (the visual shop
|
| 50 |
# window). The numeric long tail lives on the Full results / Leaderboard
|
| 51 |
# tab, not here.
|
|
@@ -134,6 +136,9 @@ def _sub_payload(row: dict, render_resolver, diff_resolver) -> dict:
|
|
| 134 |
return {
|
| 135 |
"id": sid,
|
| 136 |
"name": row.get("submission_name") or "(unnamed submission)",
|
|
|
|
|
|
|
|
|
|
| 137 |
"who": row.get("submitter_name") or "",
|
| 138 |
"score": row.get("aggregate_score"),
|
| 139 |
"validity": row.get("validity_rate"),
|
|
@@ -297,7 +302,7 @@ body {
|
|
| 297 |
.gallery { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
|
| 298 |
.grid-head, .grow {
|
| 299 |
display: grid;
|
| 300 |
-
grid-template-columns: 52px minmax(220px, 1.4fr)
|
| 301 |
align-items: stretch;
|
| 302 |
}
|
| 303 |
.grid-head {
|
|
@@ -333,7 +338,8 @@ body {
|
|
| 333 |
.rank.medal-1 { color: #b8860b; } .rank.medal-2 { color: #6b7280; } .rank.medal-3 { color: #a0522d; }
|
| 334 |
|
| 335 |
.ident { padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
|
| 336 |
-
.ident .sub-name { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
|
|
|
|
| 337 |
.ident .submitter { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }
|
| 338 |
|
| 339 |
.score-cell { padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
|
|
@@ -364,28 +370,18 @@ body {
|
|
| 364 |
.thumb.failed:hover { transform: none; box-shadow: none; border-color: #e9b3ae; }
|
| 365 |
.thumb.failed .ftag { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--bad); text-transform: uppercase; letter-spacing: .04em; text-align: center; line-height: 1.4; }
|
| 366 |
|
| 367 |
-
|
| 368 |
-
.
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
}
|
| 372 |
-
.
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
.
|
| 376 |
-
.
|
| 377 |
-
.
|
| 378 |
-
.
|
| 379 |
-
.detail-foot a:hover { text-decoration: underline; }
|
| 380 |
-
.row-toggle {
|
| 381 |
-
grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px;
|
| 382 |
-
padding: 7px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--ink-faint);
|
| 383 |
-
text-transform: uppercase; letter-spacing: .05em; border-top: 1px solid var(--line);
|
| 384 |
-
background: #fcfcfe; user-select: none;
|
| 385 |
-
}
|
| 386 |
-
.row-toggle:hover { color: var(--accent); background: var(--accent-soft); }
|
| 387 |
-
.row-toggle .chev { transition: transform .2s ease; }
|
| 388 |
-
.sub-row.open .row-toggle .chev { transform: rotate(180deg); }
|
| 389 |
|
| 390 |
.empty-note { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--ink-faint); font-size: 14px; }
|
| 391 |
|
|
@@ -416,13 +412,13 @@ body {
|
|
| 416 |
_BODY = """
|
| 417 |
<div class="wrap">
|
| 418 |
<div class="controls">
|
| 419 |
-
<div class="label">
|
| 420 |
<div class="picker-row">
|
| 421 |
<div class="pills" id="pills"></div>
|
| 422 |
<div class="picker-anchor">
|
| 423 |
-
<button class="add-fixture" id="addFixtureBtn">+ Add
|
| 424 |
<div class="popover" id="popover" hidden>
|
| 425 |
-
<input type="text" class="popover-search" id="popoverSearch" placeholder="Search
|
| 426 |
<div class="popover-list" id="popoverList"></div>
|
| 427 |
</div>
|
| 428 |
</div>
|
|
@@ -557,14 +553,14 @@ function renderPopoverList() {
|
|
| 557 |
+ tag + '<span class="iname">' + esc(f.name) + '</span></div>';
|
| 558 |
}).join('');
|
| 559 |
});
|
| 560 |
-
if (!html) html = '<div class="popover-empty">No
|
| 561 |
list.innerHTML = html;
|
| 562 |
// At the cap, show a note rather than silently dropping a pick.
|
| 563 |
const existingCap = document.getElementById('popoverCap');
|
| 564 |
if (existingCap) existingCap.remove();
|
| 565 |
if (selected.length >= MAX_FIXTURES) {
|
| 566 |
list.insertAdjacentHTML('afterend',
|
| 567 |
-
'<div class="popover-cap" id="popoverCap">Max ' + MAX_FIXTURES + '
|
| 568 |
}
|
| 569 |
list.querySelectorAll('.popover-item').forEach(it => {
|
| 570 |
it.onclick = () => {
|
|
@@ -678,23 +674,24 @@ function buildGallery() {
|
|
| 678 |
row.className = 'grow sub-row';
|
| 679 |
const medal = i < 3 ? 'medal-' + (i + 1) : '';
|
| 680 |
const imperfect = (s.validity !== null && s.validity < 1) ? 'imperfect' : '';
|
|
|
|
|
|
|
|
|
|
| 681 |
let cells = '<div class="rank ' + medal + '">' + (i + 1) + '</div>'
|
| 682 |
-
+ '<div class="ident">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
+ '<div class="score-cell"><span class="agg">' + fmt(s.score, 3) + '</span>'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
+ '<span class="validity ' + imperfect + '">' + pct(s.validity) + ' <span class="vlabel">valid</span></span></div>';
|
| 685 |
selected.forEach(id => {
|
| 686 |
cells += '<div class="thumb-cell">' + thumbHTML(gridRenderFor(s, id), 'data-sub="' + esc(s.id) + '" data-fix="' + esc(id) + '"', true) + '</div>';
|
| 687 |
});
|
| 688 |
-
cells += '<div class="row-toggle" data-toggle="' + esc(s.id) + '">more numbers <span class="chev">▾</span></div>';
|
| 689 |
-
cells += '<div class="detail" id="detail-' + esc(s.id) + '">'
|
| 690 |
-
+ '<div class="metric-grid">'
|
| 691 |
-
+ '<div class="metric"><div class="m-label">Generation</div><div class="m-val">' + fmt(s.gen, 3) + '</div></div>'
|
| 692 |
-
+ '<div class="metric"><div class="m-label">Editing</div><div class="m-val">' + fmt(s.edit, 3) + '</div></div>'
|
| 693 |
-
+ '<div class="metric"><div class="m-label">Validity</div><div class="m-val">' + pct(s.validity) + '</div></div>'
|
| 694 |
-
+ '</div>'
|
| 695 |
-
+ '<div class="detail-foot"><span>Submitted ' + esc(s.date) + (s.version ? ' - cadgenbench v' + esc(s.version) : '') + '</span>'
|
| 696 |
-
+ (s.blobUrl ? '<a href="' + esc(s.blobUrl) + '" target="_blank" rel="noopener">Download ZIP</a>' : '')
|
| 697 |
-
+ '</div></div>';
|
| 698 |
row.innerHTML = cells;
|
| 699 |
g.appendChild(row);
|
| 700 |
});
|
|
@@ -704,13 +701,6 @@ function buildGallery() {
|
|
| 704 |
}
|
| 705 |
|
| 706 |
function wireGallery() {
|
| 707 |
-
document.querySelectorAll('[data-toggle]').forEach(t => {
|
| 708 |
-
t.onclick = () => {
|
| 709 |
-
const id = t.dataset.toggle;
|
| 710 |
-
document.getElementById('detail-' + id).classList.toggle('show');
|
| 711 |
-
t.closest('.sub-row').classList.toggle('open');
|
| 712 |
-
};
|
| 713 |
-
});
|
| 714 |
document.querySelectorAll('.thumb[data-sub]').forEach(th => {
|
| 715 |
th.onclick = () => {
|
| 716 |
const sub = DATA.subs.find(x => x.id === th.dataset.sub);
|
|
@@ -737,7 +727,7 @@ function openModal(fxId, sub) {
|
|
| 737 |
}
|
| 738 |
const cad = (cell.cad === null || cell.cad === undefined) ? '-' : Number(cell.cad).toFixed(3);
|
| 739 |
document.getElementById('modalNote').innerHTML =
|
| 740 |
-
'CAD score for this
|
| 741 |
+ '(shape similarity, interface, topology + 3D view) opens from the report viewer.';
|
| 742 |
document.getElementById('modalBack').classList.add('show');
|
| 743 |
}
|
|
|
|
| 46 |
|
| 47 |
import json
|
| 48 |
|
| 49 |
+
from leaderboard import _report_relative_url
|
| 50 |
+
|
| 51 |
# Gallery shows the top-N verified submissions only (the visual shop
|
| 52 |
# window). The numeric long tail lives on the Full results / Leaderboard
|
| 53 |
# tab, not here.
|
|
|
|
| 136 |
return {
|
| 137 |
"id": sid,
|
| 138 |
"name": row.get("submission_name") or "(unnamed submission)",
|
| 139 |
+
"reportUrl": _report_relative_url(
|
| 140 |
+
sid, row.get("status"), row.get("submission_sha256"),
|
| 141 |
+
),
|
| 142 |
"who": row.get("submitter_name") or "",
|
| 143 |
"score": row.get("aggregate_score"),
|
| 144 |
"validity": row.get("validity_rate"),
|
|
|
|
| 302 |
.gallery { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
|
| 303 |
.grid-head, .grow {
|
| 304 |
display: grid;
|
| 305 |
+
grid-template-columns: 52px minmax(220px, 1.4fr) 170px repeat(var(--ncol, 3), minmax(150px, 1fr));
|
| 306 |
align-items: stretch;
|
| 307 |
}
|
| 308 |
.grid-head {
|
|
|
|
| 338 |
.rank.medal-1 { color: #b8860b; } .rank.medal-2 { color: #6b7280; } .rank.medal-3 { color: #a0522d; }
|
| 339 |
|
| 340 |
.ident { padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
|
| 341 |
+
.ident .sub-name { font-weight: 600; font-size: 14.5px; line-height: 1.25; color: var(--ink); text-decoration: none; }
|
| 342 |
+
a.sub-name:hover { color: var(--accent); text-decoration: underline; }
|
| 343 |
.ident .submitter { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }
|
| 344 |
|
| 345 |
.score-cell { padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
|
|
|
|
| 370 |
.thumb.failed:hover { transform: none; box-shadow: none; border-color: #e9b3ae; }
|
| 371 |
.thumb.failed .ftag { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--bad); text-transform: uppercase; letter-spacing: .04em; text-align: center; line-height: 1.4; }
|
| 372 |
|
| 373 |
+
/* Inline Gen/Edit breakdown beneath the aggregate score (replaces the old
|
| 374 |
+
"more numbers" expander). Validity stays as its own line below. */
|
| 375 |
+
.score-cell .score-breakdown { display: flex; gap: 14px; margin: 1px 0; }
|
| 376 |
+
.score-cell .sb { display: flex; flex-direction: column; line-height: 1.15; }
|
| 377 |
+
.score-cell .sb-l { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 700; }
|
| 378 |
+
.score-cell .sb-v { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--ink-soft); }
|
| 379 |
+
|
| 380 |
+
/* Download link + submission date, tucked under the submitter name. */
|
| 381 |
+
.ident .ident-foot { display: flex; align-items: center; gap: 10px; margin-top: 5px; flex-wrap: wrap; }
|
| 382 |
+
.ident .dl { font-size: 11.5px; font-weight: 600; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
|
| 383 |
+
.ident .dl .dl-ic { font-size: 13px; line-height: 1; }
|
| 384 |
+
.ident .dl:hover { text-decoration: underline; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
.empty-note { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--ink-faint); font-size: 14px; }
|
| 387 |
|
|
|
|
| 412 |
_BODY = """
|
| 413 |
<div class="wrap">
|
| 414 |
<div class="controls">
|
| 415 |
+
<div class="label">Samples shown <span class="picker-help">- pick up to 3 to compare across all models (changes columns globally)</span></div>
|
| 416 |
<div class="picker-row">
|
| 417 |
<div class="pills" id="pills"></div>
|
| 418 |
<div class="picker-anchor">
|
| 419 |
+
<button class="add-fixture" id="addFixtureBtn">+ Add sample</button>
|
| 420 |
<div class="popover" id="popover" hidden>
|
| 421 |
+
<input type="text" class="popover-search" id="popoverSearch" placeholder="Search samples..." autocomplete="off">
|
| 422 |
<div class="popover-list" id="popoverList"></div>
|
| 423 |
</div>
|
| 424 |
</div>
|
|
|
|
| 553 |
+ tag + '<span class="iname">' + esc(f.name) + '</span></div>';
|
| 554 |
}).join('');
|
| 555 |
});
|
| 556 |
+
if (!html) html = '<div class="popover-empty">No samples match \\u201c' + esc(popoverQuery) + '\\u201d.</div>';
|
| 557 |
list.innerHTML = html;
|
| 558 |
// At the cap, show a note rather than silently dropping a pick.
|
| 559 |
const existingCap = document.getElementById('popoverCap');
|
| 560 |
if (existingCap) existingCap.remove();
|
| 561 |
if (selected.length >= MAX_FIXTURES) {
|
| 562 |
list.insertAdjacentHTML('afterend',
|
| 563 |
+
'<div class="popover-cap" id="popoverCap">Max ' + MAX_FIXTURES + ' samples - remove one to add another.</div>');
|
| 564 |
}
|
| 565 |
list.querySelectorAll('.popover-item').forEach(it => {
|
| 566 |
it.onclick = () => {
|
|
|
|
| 674 |
row.className = 'grow sub-row';
|
| 675 |
const medal = i < 3 ? 'medal-' + (i + 1) : '';
|
| 676 |
const imperfect = (s.validity !== null && s.validity < 1) ? 'imperfect' : '';
|
| 677 |
+
const nameHTML = s.reportUrl
|
| 678 |
+
? '<a class="sub-name" href="' + esc(s.reportUrl) + '" target="_blank" rel="noopener">' + esc(s.name) + '</a>'
|
| 679 |
+
: '<span class="sub-name">' + esc(s.name) + '</span>';
|
| 680 |
let cells = '<div class="rank ' + medal + '">' + (i + 1) + '</div>'
|
| 681 |
+
+ '<div class="ident">' + nameHTML
|
| 682 |
+
+ '<span class="submitter">' + esc(s.who) + '</span>'
|
| 683 |
+
+ '<div class="ident-foot">'
|
| 684 |
+
+ (s.blobUrl ? '<a class="dl" href="' + esc(s.blobUrl) + '" target="_blank" rel="noopener"><span class="dl-ic">⇣</span>Download ZIP</a>' : '')
|
| 685 |
+
+ '</div></div>'
|
| 686 |
+ '<div class="score-cell"><span class="agg">' + fmt(s.score, 3) + '</span>'
|
| 687 |
+
+ '<div class="score-breakdown">'
|
| 688 |
+
+ '<span class="sb"><span class="sb-l">Gen</span><span class="sb-v">' + fmt(s.gen, 3) + '</span></span>'
|
| 689 |
+
+ '<span class="sb"><span class="sb-l">Edit</span><span class="sb-v">' + fmt(s.edit, 3) + '</span></span>'
|
| 690 |
+
+ '</div>'
|
| 691 |
+ '<span class="validity ' + imperfect + '">' + pct(s.validity) + ' <span class="vlabel">valid</span></span></div>';
|
| 692 |
selected.forEach(id => {
|
| 693 |
cells += '<div class="thumb-cell">' + thumbHTML(gridRenderFor(s, id), 'data-sub="' + esc(s.id) + '" data-fix="' + esc(id) + '"', true) + '</div>';
|
| 694 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 695 |
row.innerHTML = cells;
|
| 696 |
g.appendChild(row);
|
| 697 |
});
|
|
|
|
| 701 |
}
|
| 702 |
|
| 703 |
function wireGallery() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
document.querySelectorAll('.thumb[data-sub]').forEach(th => {
|
| 705 |
th.onclick = () => {
|
| 706 |
const sub = DATA.subs.find(x => x.id === th.dataset.sub);
|
|
|
|
| 727 |
}
|
| 728 |
const cad = (cell.cad === null || cell.cad === undefined) ? '-' : Number(cell.cad).toFixed(3);
|
| 729 |
document.getElementById('modalNote').innerHTML =
|
| 730 |
+
'CAD score for this sample: <b>' + cad + '</b>. The full per-sample report '
|
| 731 |
+ '(shape similarity, interface, topology + 3D view) opens from the report viewer.';
|
| 732 |
document.getElementById('modalBack').classList.add('show');
|
| 733 |
}
|
submit.py
CHANGED
|
@@ -437,7 +437,7 @@ def handle_submit(
|
|
| 437 |
|
| 438 |
yield _submit_status(
|
| 439 |
"working",
|
| 440 |
-
"Validating submission (unpacking the zip, checking the
|
| 441 |
"and STEP files)…",
|
| 442 |
)
|
| 443 |
|
|
@@ -481,7 +481,7 @@ def handle_submit(
|
|
| 481 |
)
|
| 482 |
yield _submit_status(
|
| 483 |
"working",
|
| 484 |
-
f"Uploading `{submission_id}` ({len(fixture_names)}
|
| 485 |
f"queuing the evaluation… (this can take a moment, and retries "
|
| 486 |
f"automatically if the Hub is busy).",
|
| 487 |
)
|
|
@@ -502,14 +502,14 @@ def handle_submit(
|
|
| 502 |
progress.publish(
|
| 503 |
submission_id,
|
| 504 |
progress.QUEUED,
|
| 505 |
-
f"Queued ({len(fixture_names)}
|
| 506 |
f"evaluation to start…",
|
| 507 |
)
|
| 508 |
_spawn_worker(submission_id, blob_url, sorted(fixture_names))
|
| 509 |
yield _submit_status(
|
| 510 |
"queued",
|
| 511 |
f"Submission `{submission_id}` queued ({len(fixture_names)} "
|
| 512 |
-
f"
|
| 513 |
f"the **Unvalidated** leaderboard and flips to completed when the "
|
| 514 |
f"job finishes (typically 1–3 minutes). Live progress below.",
|
| 515 |
)
|
|
@@ -603,7 +603,7 @@ def _load_and_validate_meta(unpacked: Path) -> dict[str, Any]:
|
|
| 603 |
if not meta_path.is_file():
|
| 604 |
raise _ValidationError(
|
| 605 |
"Zip is missing top-level `meta.json` (expected at the root of "
|
| 606 |
-
"the zip, alongside the per-
|
| 607 |
)
|
| 608 |
try:
|
| 609 |
meta = json.loads(meta_path.read_text())
|
|
@@ -667,7 +667,7 @@ def _validate_fixture_set(unpacked: Path) -> set[str]:
|
|
| 667 |
inputs_root = data_inputs_dir()
|
| 668 |
except Exception as e: # noqa: BLE001 - paths.py raises a few types
|
| 669 |
raise _ValidationError(
|
| 670 |
-
f"Server-side error resolving the
|
| 671 |
f"({type(e).__name__}: {e})."
|
| 672 |
) from e
|
| 673 |
expected = {p.name for p in inputs_root.iterdir() if p.is_dir()}
|
|
@@ -677,11 +677,11 @@ def _validate_fixture_set(unpacked: Path) -> set[str]:
|
|
| 677 |
if missing or extras:
|
| 678 |
parts: list[str] = []
|
| 679 |
if missing:
|
| 680 |
-
parts.append(f"missing
|
| 681 |
if extras:
|
| 682 |
parts.append(f"unexpected folder(s): {', '.join(sorted(extras))}")
|
| 683 |
raise _ValidationError(
|
| 684 |
-
"
|
| 685 |
)
|
| 686 |
return expected
|
| 687 |
|
|
@@ -694,7 +694,7 @@ def _validate_steps_parseable(unpacked: Path, fixture_names: set[str]) -> None:
|
|
| 694 |
# 1-5s, so fanning out a 5+ fixture set across cpu-upgrade vCPUs
|
| 695 |
# cuts wall time roughly linearly. ex.map raises the first child
|
| 696 |
# exception when its iterator is consumed, so wrapping in list()
|
| 697 |
-
# preserves the same `
|
| 698 |
# sequential loop did.
|
| 699 |
def _check_one_step(name: str) -> None:
|
| 700 |
step = _candidate_step_path(unpacked / name)
|
|
@@ -704,13 +704,13 @@ def _validate_steps_parseable(unpacked: Path, fixture_names: set[str]) -> None:
|
|
| 704 |
return
|
| 705 |
if step.stat().st_size == 0:
|
| 706 |
raise _ValidationError(
|
| 707 |
-
f"
|
| 708 |
)
|
| 709 |
try:
|
| 710 |
parse_step(step)
|
| 711 |
except RuntimeError as e:
|
| 712 |
raise _ValidationError(
|
| 713 |
-
f"
|
| 714 |
f"as STEP geometry: {e}"
|
| 715 |
) from e
|
| 716 |
|
|
|
|
| 437 |
|
| 438 |
yield _submit_status(
|
| 439 |
"working",
|
| 440 |
+
"Validating submission (unpacking the zip, checking the sample set "
|
| 441 |
"and STEP files)…",
|
| 442 |
)
|
| 443 |
|
|
|
|
| 481 |
)
|
| 482 |
yield _submit_status(
|
| 483 |
"working",
|
| 484 |
+
f"Uploading `{submission_id}` ({len(fixture_names)} samples) and "
|
| 485 |
f"queuing the evaluation… (this can take a moment, and retries "
|
| 486 |
f"automatically if the Hub is busy).",
|
| 487 |
)
|
|
|
|
| 502 |
progress.publish(
|
| 503 |
submission_id,
|
| 504 |
progress.QUEUED,
|
| 505 |
+
f"Queued ({len(fixture_names)} samples) — waiting for the "
|
| 506 |
f"evaluation to start…",
|
| 507 |
)
|
| 508 |
_spawn_worker(submission_id, blob_url, sorted(fixture_names))
|
| 509 |
yield _submit_status(
|
| 510 |
"queued",
|
| 511 |
f"Submission `{submission_id}` queued ({len(fixture_names)} "
|
| 512 |
+
f"samples). The eval runs on an HF Jobs GPU; your row appears on "
|
| 513 |
f"the **Unvalidated** leaderboard and flips to completed when the "
|
| 514 |
f"job finishes (typically 1–3 minutes). Live progress below.",
|
| 515 |
)
|
|
|
|
| 603 |
if not meta_path.is_file():
|
| 604 |
raise _ValidationError(
|
| 605 |
"Zip is missing top-level `meta.json` (expected at the root of "
|
| 606 |
+
"the zip, alongside the per-sample folders)."
|
| 607 |
)
|
| 608 |
try:
|
| 609 |
meta = json.loads(meta_path.read_text())
|
|
|
|
| 667 |
inputs_root = data_inputs_dir()
|
| 668 |
except Exception as e: # noqa: BLE001 - paths.py raises a few types
|
| 669 |
raise _ValidationError(
|
| 670 |
+
f"Server-side error resolving the sample set "
|
| 671 |
f"({type(e).__name__}: {e})."
|
| 672 |
) from e
|
| 673 |
expected = {p.name for p in inputs_root.iterdir() if p.is_dir()}
|
|
|
|
| 677 |
if missing or extras:
|
| 678 |
parts: list[str] = []
|
| 679 |
if missing:
|
| 680 |
+
parts.append(f"missing sample(s): {', '.join(sorted(missing))}")
|
| 681 |
if extras:
|
| 682 |
parts.append(f"unexpected folder(s): {', '.join(sorted(extras))}")
|
| 683 |
raise _ValidationError(
|
| 684 |
+
"Sample set does not match the dataset. " + "; ".join(parts) + "."
|
| 685 |
)
|
| 686 |
return expected
|
| 687 |
|
|
|
|
| 694 |
# 1-5s, so fanning out a 5+ fixture set across cpu-upgrade vCPUs
|
| 695 |
# cuts wall time roughly linearly. ex.map raises the first child
|
| 696 |
# exception when its iterator is consumed, so wrapping in list()
|
| 697 |
+
# preserves the same `Sample <name>` rejection text as the
|
| 698 |
# sequential loop did.
|
| 699 |
def _check_one_step(name: str) -> None:
|
| 700 |
step = _candidate_step_path(unpacked / name)
|
|
|
|
| 704 |
return
|
| 705 |
if step.stat().st_size == 0:
|
| 706 |
raise _ValidationError(
|
| 707 |
+
f"Sample `{name}` has an empty `{step.name}`."
|
| 708 |
)
|
| 709 |
try:
|
| 710 |
parse_step(step)
|
| 711 |
except RuntimeError as e:
|
| 712 |
raise _ValidationError(
|
| 713 |
+
f"Sample `{name}` has an `{step.name}` that is not loadable "
|
| 714 |
f"as STEP geometry: {e}"
|
| 715 |
) from e
|
| 716 |
|
tasks.py
CHANGED
|
@@ -164,7 +164,7 @@ def _render_task_card(task: dict, idx: int, asset_url) -> str:
|
|
| 164 |
def _render_summary_table(tasks: list[dict]) -> str:
|
| 165 |
rows = [
|
| 166 |
'<table class="summary-table" id="summary-table">',
|
| 167 |
-
"<thead><tr><th>
|
| 168 |
]
|
| 169 |
for i, t in enumerate(tasks):
|
| 170 |
rows.append(
|
|
@@ -225,7 +225,7 @@ def render_tasks_page(tasks: list[dict], asset_url) -> str:
|
|
| 225 |
p.append(_render_summary_table(tasks))
|
| 226 |
else:
|
| 227 |
p.append(
|
| 228 |
-
'<p class="note">No tasks found in the
|
| 229 |
)
|
| 230 |
p.append("</div>")
|
| 231 |
|
|
|
|
| 164 |
def _render_summary_table(tasks: list[dict]) -> str:
|
| 165 |
rows = [
|
| 166 |
'<table class="summary-table" id="summary-table">',
|
| 167 |
+
"<thead><tr><th>Sample</th><th>Type</th></tr></thead><tbody>",
|
| 168 |
]
|
| 169 |
for i, t in enumerate(tasks):
|
| 170 |
rows.append(
|
|
|
|
| 225 |
p.append(_render_summary_table(tasks))
|
| 226 |
else:
|
| 227 |
p.append(
|
| 228 |
+
'<p class="note">No tasks found in the sample inputs dataset.</p>'
|
| 229 |
)
|
| 230 |
p.append("</div>")
|
| 231 |
|
tests/test_smoke.py
CHANGED
|
@@ -4,7 +4,7 @@ Boots ``app.py`` in a subprocess (via the ``app_url`` fixture in
|
|
| 4 |
:mod:`conftest`) and asserts the Phase D minimum:
|
| 5 |
|
| 6 |
- All three Gradio tabs render.
|
| 7 |
-
- The
|
| 8 |
(Validated + Unvalidated, per the two-tier viewer landed in C3).
|
| 9 |
|
| 10 |
If the Space won't load these tabs or the leaderboards don't render,
|
|
@@ -34,10 +34,11 @@ def test_three_tabs_render(app_url):
|
|
| 34 |
|
| 35 |
|
| 36 |
def test_two_leaderboard_widgets_render(app_url):
|
| 37 |
-
"""Both Validated and Unvalidated leaderboards render on the
|
| 38 |
|
| 39 |
-
|
| 40 |
-
is mounted-but-hidden until selected;
|
|
|
|
| 41 |
assert. The two widgets are identified by their labels (set in
|
| 42 |
app.py). The labels are case-sensitive substrings that don't overlap
|
| 43 |
("Validated Leaderboard" is not a substring of "Unvalidated
|
|
@@ -54,7 +55,7 @@ def test_two_leaderboard_widgets_render(app_url):
|
|
| 54 |
try:
|
| 55 |
page = browser.new_page()
|
| 56 |
page.goto(app_url)
|
| 57 |
-
page.get_by_role("tab", name="
|
| 58 |
expect(
|
| 59 |
page.get_by_text("Validated Leaderboard", exact=True)
|
| 60 |
.and_(page.locator("p"))
|
|
|
|
| 4 |
:mod:`conftest`) and asserts the Phase D minimum:
|
| 5 |
|
| 6 |
- All three Gradio tabs render.
|
| 7 |
+
- The Detailed View tab carries two stacked ``Leaderboard`` widgets
|
| 8 |
(Validated + Unvalidated, per the two-tier viewer landed in C3).
|
| 9 |
|
| 10 |
If the Space won't load these tabs or the leaderboards don't render,
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def test_two_leaderboard_widgets_render(app_url):
|
| 37 |
+
"""Both Validated and Unvalidated leaderboards render on the Detailed View tab.
|
| 38 |
|
| 39 |
+
The Leaderboard (visual) tab is the default (first) tab, so the
|
| 40 |
+
Detailed View tab's content is mounted-but-hidden until selected;
|
| 41 |
+
click the tab first, then
|
| 42 |
assert. The two widgets are identified by their labels (set in
|
| 43 |
app.py). The labels are case-sensitive substrings that don't overlap
|
| 44 |
("Validated Leaderboard" is not a substring of "Unvalidated
|
|
|
|
| 55 |
try:
|
| 56 |
page = browser.new_page()
|
| 57 |
page.goto(app_url)
|
| 58 |
+
page.get_by_role("tab", name="Detailed View").click()
|
| 59 |
expect(
|
| 60 |
page.get_by_text("Validated Leaderboard", exact=True)
|
| 61 |
.and_(page.locator("p"))
|