Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tools/build-catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ROOT = Path(__file__).resolve().parent.parent
OUTPUT_DIR = ROOT / "run-on-jobs"
HUB_BASE = "https://huggingface.co/datasets/uv-scripts"
SPACE_URL = "https://huggingface.co/spaces/uv-scripts/run-on-jobs"

TASKS = {
"ocr": "OCR",
Expand Down Expand Up @@ -352,9 +353,10 @@ def model_row_html(task, model, recipes):
label = f"{len(others)} more recipe{'s' if len(others) > 1 else ''}"
more = f'<details class="more"><summary>{label}</summary>' + "".join(recipe_html(recipe) for recipe in others) + "</details>"
return (
f'<li data-task="{html.escape(task)}" data-text="{html.escape(search_text)}"><details>'
f'<li data-task="{html.escape(task)}" data-model="{html.escape(model.lower())}" data-text="{html.escape(search_text)}"><details>'
f'<summary><span class="name">{html.escape(model)}</span><span class="state {row_class}">{html.escape(row_status)}</span></summary>'
+ f'<p class="model-link small muted"><a href="https://huggingface.co/{html.escape(model)}">Open the model page</a></p>'
+ f'<p class="model-link small muted"><a href="https://huggingface.co/{html.escape(model)}">Open the model page</a>'
+ f' · <a href="{SPACE_URL}?model={html.escape(model)}">Link to this model</a></p>'
+ recipe_html(best) + more + "</details></li>"
)

Expand Down Expand Up @@ -421,6 +423,7 @@ def render_agents():
## Find a recipe

- `hf download uv-scripts/run-on-jobs recipes.json --repo-type space`, then look for the model in `recipes[].models`.
- To send a person to one model, link to `https://huggingface.co/spaces/uv-scripts/run-on-jobs?model=<org>/<name>`. The page opens at that model.
- `kind`: `run` applies a model to data; `train` fine-tunes one.
- `source`: `header` carries its launch settings; `documented` is an example from the script's docs; `flags-needed` has no command, so read the script first.
- Read a script's docstring and options: `curl -s <url> | head -100`. Running it locally may fail on GPU-only dependencies.
Expand Down
16 changes: 16 additions & 0 deletions tools/run-on-jobs-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
@media (prefers-reduced-motion:reduce){summary::before{transition:none}}
.entry{font-size:15px;margin-top:12px}
.model-link{margin:2px 12px 8px 28px}
ul.models>li{scroll-margin-top:12px}
</style>
</head>
<body>
Expand Down Expand Up @@ -279,6 +280,21 @@ <h2>For agents</h2>
apply();
});
}
// ?model=org/name opens the page at that model. The Hub passes the query string of the Space page to this page.
const wantedModel = (new URLSearchParams(location.search).get('model') || '').trim().toLowerCase();
if (wantedModel) {
const matches = items.filter(item => item.dataset.model === wantedModel);
for (const item of matches) item.querySelector('details').open = true;
if (matches.length) {
matches[0].scrollIntoView();
// The example image above can load later and move the list, so scroll again once the page has loaded.
addEventListener('load', () => matches[0].scrollIntoView());
} else {
input.value = wantedModel;
apply();
document.getElementById('find').scrollIntoView();
}
}
const stepButtons = [...document.querySelectorAll('.switch button')];
const steps = [...document.querySelectorAll('[data-step]')];
function showStep(name) {
Expand Down
Loading