Skip to content

Commit eff03b5

Browse files
davanstrienclaude
andauthored
Add Hub metadata links for discoverability (#15)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4a99bf0 commit eff03b5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ocr_bench/cli.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,19 @@ def cmd_publish(args: argparse.Namespace) -> None:
606606

607607
api.add_space_variable(repo_id=space_id, key="REPOS", value=results)
608608

609+
# Update Space metadata to link to results dataset
610+
try:
611+
from huggingface_hub import metadata_update
612+
613+
metadata_update(
614+
space_id,
615+
{"datasets": [results], "tags": ["ocr-bench"]},
616+
repo_type="space",
617+
overwrite=True,
618+
)
619+
except Exception as exc:
620+
logger.warning("space_metadata_update_failed", error=str(exc))
621+
609622
url = f"https://huggingface.co/spaces/{space_id}"
610623
console.print(f"[green]Space published![/green] {url}")
611624

src/ocr_bench/publish.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ def _build_readme(
193193
"tags:",
194194
" - ocr-bench",
195195
" - leaderboard",
196+
"source_datasets:",
197+
f" - {metadata.source_dataset}",
196198
"configs:",
197199
" - config_name: default",
198200
" data_files:",

0 commit comments

Comments
 (0)