Spaces:
Sleeping
Sleeping
Ask Base120: sign-in (OAuth) live mode, wags rev-ask-base120-space-007 APPROVE (MTSMU + Parallax Quilter)
7f03c90 verified Download build_examples_cache.py from sum-guy-429/ask-base120: direct link, hf CLI and curl.
- Browser
- Download file 978 Bytes
-
https://huggingface.co/spaces/sum-guy-429/ask-base120/resolve/main/build_examples_cache.py
- Command line
-
hf download hf://spaces/sum-guy-429/ask-base120/build_examples_cache.py
-
curl -L -o build_examples_cache.py https://huggingface.co/spaces/sum-guy-429/ask-base120/resolve/main/build_examples_cache.py
978 Bytes
| """Precompute Auto-mode answers for the 5 one-click examples. Maintainer-only: run locally with | |
| HF_TOKEN set; that token pays for this one-off build. Never runs on the Space.""" | |
| import json | |
| import os | |
| from datetime import datetime, timezone | |
| import app | |
| token = os.environ.get("HF_TOKEN") | |
| if not token: | |
| raise SystemExit("Set HF_TOKEN (the maintainer's token) to build the cache.") | |
| out = {} | |
| for ex in app.EXAMPLES: | |
| status, plain, structured, *cards = app._run_live(ex, "Auto (LLM picks)", None, token) | |
| if "⚠️" in status + plain + structured or "💳" in status or "🔑" in status or "🚫" in status: | |
| raise SystemExit(f"inference failed for {ex!r}: {status} {plain[:100]}") | |
| out[ex] = {"status": status, "plain": plain, "structured": structured, "cards": cards, | |
| "model": app.MODEL_ID, "generated_at": datetime.now(timezone.utc).isoformat()} | |
| print("ok", status) | |
| app.CACHE_FILE.write_text(json.dumps(out, indent=1, ensure_ascii=False)) | |