Michael Rabinovich Cursor commited on
Commit ·
2ec97dd
1
Parent(s): 882faa0
leaderboard: reclaim Gradio chrome + responsive mobile gallery
Browse files- Hide the Gradio footer and tighten outer padding (the unused space
between Refresh and the footer) and grow the gallery box to use it, so
more rows fit in one viewport.
- Mobile: the 4-sample matrix no longer clips. On narrow screens the
table scrolls horizontally (swipe), the rank column is dropped, the
Submission column is frozen to the left, and the score breakdown is
hidden -- so the renders are actually visible and you can tell which
model each belongs to, with the header + GT row still pinned.
Co-authored-by: Cursor <cursoragent@cursor.com>
- app.py +14 -2
- gallery.py +35 -2
app.py
CHANGED
|
@@ -931,9 +931,21 @@ def _tasks_iframe_html() -> str:
|
|
| 931 |
)
|
| 932 |
|
| 933 |
|
| 934 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 935 |
# Single compact title line (keeps vertical space for the gallery rows).
|
| 936 |
-
gr.Markdown("### CADGenBench Leaderboard")
|
| 937 |
|
| 938 |
with gr.Tab("Leaderboard"):
|
| 939 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|
|
|
|
| 931 |
)
|
| 932 |
|
| 933 |
|
| 934 |
+
# Reclaim vertical space so the gallery can show more rows in one viewport:
|
| 935 |
+
# hide the Gradio footer ("Built with Gradio - Settings") and tighten the
|
| 936 |
+
# page's outer padding / inter-block gap. Scoped to cosmetics only.
|
| 937 |
+
_APP_CSS = (
|
| 938 |
+
"footer{display:none !important;}"
|
| 939 |
+
".gradio-container{padding-top:4px !important; padding-bottom:0 !important;}"
|
| 940 |
+
"#cgb-title{margin-bottom:0 !important;}"
|
| 941 |
+
"#cgb-title h3{margin:2px 0 !important;}"
|
| 942 |
+
)
|
| 943 |
+
|
| 944 |
+
with gr.Blocks(
|
| 945 |
+
title="CADGenBench Leaderboard", theme=gr.themes.Soft(), css=_APP_CSS,
|
| 946 |
+
) as blocks:
|
| 947 |
# Single compact title line (keeps vertical space for the gallery rows).
|
| 948 |
+
gr.Markdown("### CADGenBench Leaderboard", elem_id="cgb-title")
|
| 949 |
|
| 950 |
with gr.Tab("Leaderboard"):
|
| 951 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|
gallery.py
CHANGED
|
@@ -396,6 +396,39 @@ a.sub-name:hover { color: var(--accent); text-decoration: underline; }
|
|
| 396 |
.modal-note a { color: var(--accent); font-weight: 600; }
|
| 397 |
.modal-close { margin-top: 20px; width: 100%; padding: 11px; border: 1px solid var(--line-strong); background: #fafbfc; border-radius: 10px; font-family: inherit; font-weight: 600; cursor: pointer; font-size: 14px; }
|
| 398 |
.modal-close:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
"""
|
| 400 |
|
| 401 |
|
|
@@ -471,7 +504,7 @@ function groupLabel(task) { return task ? (task.charAt(0).toUpperCase() + task.s
|
|
| 471 |
// --- Gallery render -------------------------------------------------------
|
| 472 |
function buildHead() {
|
| 473 |
const head = document.getElementById('gridHead');
|
| 474 |
-
let h = '<div>#</div><div>Submission</div><div>Score</div>';
|
| 475 |
FIXTURES.forEach(f => {
|
| 476 |
const diff = f.difficulty
|
| 477 |
? '<span class="fdiff diff-' + esc((f.difficulty || '').toLowerCase()) + '">' + esc(f.difficulty) + '</span>'
|
|
@@ -632,7 +665,7 @@ function updateScrollCue() {
|
|
| 632 |
// rather than the box plus an outer page scroll. Deliberately generous: a box
|
| 633 |
// that is a little short (a touch more in-box scrolling) is far better than a
|
| 634 |
// confusing second scrollbar.
|
| 635 |
-
var CHROME_RESERVE =
|
| 636 |
function sizeGalleryBox() {
|
| 637 |
try {
|
| 638 |
const avail = (window.screen && window.screen.availHeight) || 900;
|
|
|
|
| 396 |
.modal-note a { color: var(--accent); font-weight: 600; }
|
| 397 |
.modal-close { margin-top: 20px; width: 100%; padding: 11px; border: 1px solid var(--line-strong); background: #fafbfc; border-radius: 10px; font-family: inherit; font-weight: 600; cursor: pointer; font-size: 14px; }
|
| 398 |
.modal-close:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
|
| 399 |
+
|
| 400 |
+
/* --- Mobile / narrow screens ------------------------------------------------
|
| 401 |
+
The full 4-sample matrix is far wider than a phone, so on narrow viewports
|
| 402 |
+
the table scrolls horizontally (swipe) instead of being clipped, the rank
|
| 403 |
+
column is dropped, and the Submission column is frozen to the left so you can
|
| 404 |
+
tell which model each render belongs to while swiping. The header + GT row
|
| 405 |
+
stay frozen to the top as before, so the GT thumbnails are always the
|
| 406 |
+
reference while you scroll either way. */
|
| 407 |
+
@media (max-width: 760px) {
|
| 408 |
+
.wrap { padding: 0 8px; }
|
| 409 |
+
.section-label { margin: 2px 0 6px; font-size: 12px; }
|
| 410 |
+
.gallery { overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
| 411 |
+
.grid-head, .grow {
|
| 412 |
+
grid-template-columns: 128px 78px repeat(var(--ncol, 4), 118px);
|
| 413 |
+
}
|
| 414 |
+
/* Drop the rank column (cells + header) to save width. */
|
| 415 |
+
.rank, .grid-head .h-rank { display: none; }
|
| 416 |
+
/* Freeze the identity / Submission column while swiping horizontally. */
|
| 417 |
+
.ident, .grid-head .h-sub {
|
| 418 |
+
position: sticky; left: 0; z-index: 8;
|
| 419 |
+
box-shadow: 6px 0 10px -8px rgba(20,22,28,.25);
|
| 420 |
+
}
|
| 421 |
+
.grid-head .h-sub { background: #fbfbfd; }
|
| 422 |
+
.grow.sub-row .ident { background: var(--panel); }
|
| 423 |
+
.grow.sub-row:hover .ident { background: #fafbff; }
|
| 424 |
+
.grow.gt-row .ident { background: var(--gt-soft); }
|
| 425 |
+
.ident .sub-name { font-size: 13.5px; }
|
| 426 |
+
.score-cell { padding: 12px 10px; }
|
| 427 |
+
.score-cell .agg { font-size: 19px; }
|
| 428 |
+
.score-cell .score-breakdown { display: none; } /* keep the score column narrow */
|
| 429 |
+
.thumb-cell { padding: 5px; }
|
| 430 |
+
.scroll-cue { right: 1px; }
|
| 431 |
+
}
|
| 432 |
"""
|
| 433 |
|
| 434 |
|
|
|
|
| 504 |
// --- Gallery render -------------------------------------------------------
|
| 505 |
function buildHead() {
|
| 506 |
const head = document.getElementById('gridHead');
|
| 507 |
+
let h = '<div class="h-rank">#</div><div class="h-sub">Submission</div><div class="h-score">Score</div>';
|
| 508 |
FIXTURES.forEach(f => {
|
| 509 |
const diff = f.difficulty
|
| 510 |
? '<span class="fdiff diff-' + esc((f.difficulty || '').toLowerCase()) + '">' + esc(f.difficulty) + '</span>'
|
|
|
|
| 665 |
// rather than the box plus an outer page scroll. Deliberately generous: a box
|
| 666 |
// that is a little short (a touch more in-box scrolling) is far better than a
|
| 667 |
// confusing second scrollbar.
|
| 668 |
+
var CHROME_RESERVE = 450;
|
| 669 |
function sizeGalleryBox() {
|
| 670 |
try {
|
| 671 |
const avail = (window.screen && window.screen.availHeight) || 900;
|