Spaces:
Runtime error
Runtime error
Michael Rabinovich Cursor commited on
Commit ·
1c053c8
1
Parent(s): ad03e51
eval_job: pass submission-zip download URL to the report
Browse filesBuild the submissions/<id>.zip resolve URL (same blob URL the gallery links)
and pass it as --download-url so the hosted report shows a "Download submission
ZIP" button. Bump CADGENBENCH_SHA to 0c7690e (report generator with the flag).
Co-authored-by: Cursor <cursoragent@cursor.com>
- Dockerfile +1 -1
- eval_job.py +25 -2
Dockerfile
CHANGED
|
@@ -51,7 +51,7 @@ RUN python -m venv "$VIRTUAL_ENV" \
|
|
| 51 |
# rebuild picks up the latest evaluator dependencies (including Open3D for
|
| 52 |
# alignment). Lock to a commit SHA at the v1 release for reproducible scores
|
| 53 |
# (see space-setup/post-gt-swap.md Stage F).
|
| 54 |
-
ARG CADGENBENCH_SHA=
|
| 55 |
RUN python -m pip install --no-cache-dir \
|
| 56 |
"cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
|
| 57 |
|
|
|
|
| 51 |
# rebuild picks up the latest evaluator dependencies (including Open3D for
|
| 52 |
# alignment). Lock to a commit SHA at the v1 release for reproducible scores
|
| 53 |
# (see space-setup/post-gt-swap.md Stage F).
|
| 54 |
+
ARG CADGENBENCH_SHA=0c7690e
|
| 55 |
RUN python -m pip install --no-cache-dir \
|
| 56 |
"cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
|
| 57 |
|
eval_job.py
CHANGED
|
@@ -100,6 +100,19 @@ def _render_base_url(submission_id: str) -> str:
|
|
| 100 |
return f"{HF_ENDPOINT}/buckets/{RENDER_BUCKET}/resolve/{RENDERS_DIR_IN_REPO}/{submission_id}"
|
| 101 |
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
def _upload_renders_to_bucket(
|
| 104 |
run_dir: Path, submission_id: str, token: str,
|
| 105 |
) -> list[str]:
|
|
@@ -252,7 +265,11 @@ def main() -> int:
|
|
| 252 |
# the HTML and the first viewer hits an already-warm edge cache).
|
| 253 |
_warm_render_cdn(_upload_renders_to_bucket(RUN_DIR, submission_id, token))
|
| 254 |
html_path = REPORT_HTML_DIR / f"{submission_id}.html"
|
| 255 |
-
_run_report(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
report_json = _build_report_json(RUN_DIR)
|
| 257 |
_publish_reports_and_gallery(
|
| 258 |
submission_id, html_path, report_json, submissions_repo, token,
|
|
@@ -437,7 +454,11 @@ def _run_eval(run_dir: Path, workers: int) -> None:
|
|
| 437 |
|
| 438 |
|
| 439 |
def _run_report(
|
| 440 |
-
run_dir: Path,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
) -> None:
|
| 442 |
"""Invoke ``cadgenbench report single`` for *run_dir*; raise on non-zero.
|
| 443 |
|
|
@@ -457,6 +478,8 @@ def _run_report(
|
|
| 457 |
"--gt-base-url", GT_PROXY_BASE_URL,
|
| 458 |
"--input-base-url", INPUT_PROXY_BASE_URL,
|
| 459 |
]
|
|
|
|
|
|
|
| 460 |
print(f"[eval_job] {' '.join(cmd)}", flush=True)
|
| 461 |
proc = subprocess.run(
|
| 462 |
cmd,
|
|
|
|
| 100 |
return f"{HF_ENDPOINT}/buckets/{RENDER_BUCKET}/resolve/{RENDERS_DIR_IN_REPO}/{submission_id}"
|
| 101 |
|
| 102 |
|
| 103 |
+
def _submission_zip_url(submission_id: str, submissions_repo: str) -> str:
|
| 104 |
+
"""Hub resolve URL of ``submissions/<id>.zip`` (the report's download link).
|
| 105 |
+
|
| 106 |
+
Same canonical blob URL the submit handler records as
|
| 107 |
+
``submission_blob_url`` and the gallery links, so the report's download
|
| 108 |
+
button points at the identical artifact.
|
| 109 |
+
"""
|
| 110 |
+
return (
|
| 111 |
+
f"{HF_ENDPOINT}/datasets/{submissions_repo}"
|
| 112 |
+
f"/resolve/main/submissions/{submission_id}.zip"
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
def _upload_renders_to_bucket(
|
| 117 |
run_dir: Path, submission_id: str, token: str,
|
| 118 |
) -> list[str]:
|
|
|
|
| 265 |
# the HTML and the first viewer hits an already-warm edge cache).
|
| 266 |
_warm_render_cdn(_upload_renders_to_bucket(RUN_DIR, submission_id, token))
|
| 267 |
html_path = REPORT_HTML_DIR / f"{submission_id}.html"
|
| 268 |
+
_run_report(
|
| 269 |
+
RUN_DIR, html_path,
|
| 270 |
+
render_base_url=_render_base_url(submission_id),
|
| 271 |
+
download_url=_submission_zip_url(submission_id, submissions_repo),
|
| 272 |
+
)
|
| 273 |
report_json = _build_report_json(RUN_DIR)
|
| 274 |
_publish_reports_and_gallery(
|
| 275 |
submission_id, html_path, report_json, submissions_repo, token,
|
|
|
|
| 454 |
|
| 455 |
|
| 456 |
def _run_report(
|
| 457 |
+
run_dir: Path,
|
| 458 |
+
html_out: Path,
|
| 459 |
+
*,
|
| 460 |
+
render_base_url: str | None = None,
|
| 461 |
+
download_url: str | None = None,
|
| 462 |
) -> None:
|
| 463 |
"""Invoke ``cadgenbench report single`` for *run_dir*; raise on non-zero.
|
| 464 |
|
|
|
|
| 478 |
"--gt-base-url", GT_PROXY_BASE_URL,
|
| 479 |
"--input-base-url", INPUT_PROXY_BASE_URL,
|
| 480 |
]
|
| 481 |
+
if download_url:
|
| 482 |
+
cmd += ["--download-url", download_url]
|
| 483 |
print(f"[eval_job] {' '.join(cmd)}", flush=True)
|
| 484 |
proc = subprocess.run(
|
| 485 |
cmd,
|