Download startup_progress.py from Jindrich3/openajaj: direct link, hf CLI and curl.
- Browser
- Download file 878 Bytes
-
https://huggingface.co/spaces/Jindrich3/openajaj/resolve/main/startup_progress.py
- Command line
-
hf download hf://spaces/Jindrich3/openajaj/startup_progress.py
-
curl -L -o startup_progress.py https://huggingface.co/spaces/Jindrich3/openajaj/resolve/main/startup_progress.py
878 Bytes
| """ | |
| startup_progress.py — Shared state for startup benchmark progress. | |
| Used by web.py (writer) and startup.py (reader) to show live progress | |
| on the loading page while models are being tested. | |
| """ | |
| import threading | |
| _lock = threading.Lock() | |
| # Current phase: "init", "benchmark", "ready" | |
| phase: str = "init" | |
| total: int = 0 | |
| # model -> {"status": "testing"|"ok"|"fail", "detail": str} | |
| _models: dict[str, dict] = {} | |
| def update(model: str, status: str, detail: str = "", provider: str = ""): | |
| """Record a model's benchmark status. Thread-safe.""" | |
| with _lock: | |
| _models[model] = {"status": status, "detail": detail, "provider": provider} | |
| def snapshot() -> dict: | |
| """Return current progress snapshot for the loading page.""" | |
| with _lock: | |
| return { | |
| "phase": phase, | |
| "total": total, | |
| "models": dict(_models), | |
| } | |