Michael Rabinovich Cursor commited on
Commit ·
7922a9c
1
Parent(s): 884294a
Update leaderboard Space URL after rename to CADGenBench
Browse filesThe Space moved from HuggingAI4Engineering/cadgenbench-leaderboard to
HuggingAI4Engineering/CADGenBench; point the hardcoded references at the
new URL.
Co-authored-by: Cursor <cursoragent@cursor.com>
app.py
CHANGED
|
@@ -24,6 +24,7 @@ rather than render).
|
|
| 24 |
"""
|
| 25 |
from __future__ import annotations
|
| 26 |
|
|
|
|
| 27 |
import html
|
| 28 |
import logging
|
| 29 |
import mimetypes
|
|
@@ -128,7 +129,7 @@ CITATION_BIBTEX = r"""@misc{cadgenbench2026,
|
|
| 128 |
title = {{CADGenBench}: a benchmark for {AI}-driven {CAD} generation},
|
| 129 |
year = {2026},
|
| 130 |
publisher = {Hugging Face},
|
| 131 |
-
howpublished = {\url{https://huggingface.co/spaces/HuggingAI4Engineering/
|
| 132 |
}"""
|
| 133 |
|
| 134 |
VALIDATION_GUIDELINES_MD = f"""Submissions appear on the **Unvalidated** table the moment evaluation completes. Maintainers promote rows to **Validated** after methodology review, accepting one of four evidence types (`code`, `traces`, `api`, `manual`).
|
|
@@ -964,21 +965,54 @@ def _tasks_iframe_html() -> str:
|
|
| 964 |
)
|
| 965 |
|
| 966 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 967 |
# Reclaim vertical space so the gallery can show more rows in one viewport:
|
| 968 |
# hide the Gradio footer ("Built with Gradio - Settings") and tighten the
|
| 969 |
-
# page's outer padding / inter-block gap. Scoped to cosmetics only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 970 |
_APP_CSS = (
|
| 971 |
"footer{display:none !important;}"
|
| 972 |
".gradio-container{padding-top:4px !important; padding-bottom:0 !important;}"
|
| 973 |
"#cgb-title{margin-bottom:0 !important;}"
|
| 974 |
-
"#cgb-title
|
|
|
|
|
|
|
|
|
|
| 975 |
)
|
| 976 |
|
| 977 |
with gr.Blocks(
|
| 978 |
title="CADGenBench Leaderboard", theme=gr.themes.Soft(), css=_APP_CSS,
|
| 979 |
) as blocks:
|
| 980 |
# Single compact title line (keeps vertical space for the gallery rows).
|
| 981 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 982 |
|
| 983 |
with gr.Tab("Leaderboard"):
|
| 984 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|
|
|
|
| 24 |
"""
|
| 25 |
from __future__ import annotations
|
| 26 |
|
| 27 |
+
import base64
|
| 28 |
import html
|
| 29 |
import logging
|
| 30 |
import mimetypes
|
|
|
|
| 129 |
title = {{CADGenBench}: a benchmark for {AI}-driven {CAD} generation},
|
| 130 |
year = {2026},
|
| 131 |
publisher = {Hugging Face},
|
| 132 |
+
howpublished = {\url{https://huggingface.co/spaces/HuggingAI4Engineering/CADGenBench}},
|
| 133 |
}"""
|
| 134 |
|
| 135 |
VALIDATION_GUIDELINES_MD = f"""Submissions appear on the **Unvalidated** table the moment evaluation completes. Maintainers promote rows to **Validated** after methodology review, accepting one of four evidence types (`code`, `traces`, `api`, `manual`).
|
|
|
|
| 965 |
)
|
| 966 |
|
| 967 |
|
| 968 |
+
@lru_cache(maxsize=1)
|
| 969 |
+
def _logo_data_uri() -> str:
|
| 970 |
+
"""Return the header logo as a base64 ``data:`` URI.
|
| 971 |
+
|
| 972 |
+
Inlined rather than served as a static file so the ``<img>`` renders
|
| 973 |
+
with no dependency on Gradio/FastAPI static-path allowlisting — it
|
| 974 |
+
works identically when the Space runs locally on a random port and
|
| 975 |
+
on huggingface.co. The PNG itself lives in the repo at
|
| 976 |
+
``assets/logo.png`` (reviewable as a real binary) and is read
|
| 977 |
+
relative to this module so the Docker image's working dir doesn't
|
| 978 |
+
matter. Cached because the bytes never change within a process.
|
| 979 |
+
"""
|
| 980 |
+
logo_path = Path(__file__).parent / "assets" / "logo.png"
|
| 981 |
+
data = base64.b64encode(logo_path.read_bytes()).decode("ascii")
|
| 982 |
+
return f"data:image/png;base64,{data}"
|
| 983 |
+
|
| 984 |
+
|
| 985 |
# Reclaim vertical space so the gallery can show more rows in one viewport:
|
| 986 |
# hide the Gradio footer ("Built with Gradio - Settings") and tighten the
|
| 987 |
+
# page's outer padding / inter-block gap. Scoped to cosmetics only. The
|
| 988 |
+
# logo is height-constrained (width auto-scales) so it sits in a compact
|
| 989 |
+
# band near the old `### ` title's footprint. The wordmark PNG has a
|
| 990 |
+
# transparent background and black ink, so on a dark theme it would
|
| 991 |
+
# vanish: the `.dark` rule inverts it to white ink (Gradio toggles the
|
| 992 |
+
# `.dark` class on the container; the prefers-color-scheme query covers
|
| 993 |
+
# system-driven dark mode too).
|
| 994 |
_APP_CSS = (
|
| 995 |
"footer{display:none !important;}"
|
| 996 |
".gradio-container{padding-top:4px !important; padding-bottom:0 !important;}"
|
| 997 |
"#cgb-title{margin-bottom:0 !important;}"
|
| 998 |
+
"#cgb-title .cgb-logo{height:64px;width:auto;display:block;margin:2px 0;}"
|
| 999 |
+
".dark #cgb-title .cgb-logo{filter:invert(1);}"
|
| 1000 |
+
"@media (prefers-color-scheme: dark){"
|
| 1001 |
+
"#cgb-title .cgb-logo{filter:invert(1);}}"
|
| 1002 |
)
|
| 1003 |
|
| 1004 |
with gr.Blocks(
|
| 1005 |
title="CADGenBench Leaderboard", theme=gr.themes.Soft(), css=_APP_CSS,
|
| 1006 |
) as blocks:
|
| 1007 |
# Single compact title line (keeps vertical space for the gallery rows).
|
| 1008 |
+
# The wordmark logo replaces the old `### CADGenBench Leaderboard`
|
| 1009 |
+
# markdown; alt text preserves the name for screen readers / when
|
| 1010 |
+
# images are blocked.
|
| 1011 |
+
gr.HTML(
|
| 1012 |
+
f'<img class="cgb-logo" src="{_logo_data_uri()}" '
|
| 1013 |
+
'alt="CADGenBench Leaderboard">',
|
| 1014 |
+
elem_id="cgb-title",
|
| 1015 |
+
)
|
| 1016 |
|
| 1017 |
with gr.Tab("Leaderboard"):
|
| 1018 |
# Visual-first leaderboard. The bespoke surface (sticky GT row,
|