Hugging Face Spaces host the live service side of the NU:TONIC Earth intelligence demo: satellite VLM captions, TerraMind TiM, PRO materialization, and supporting workers. Users and competition judges should normally start with the app installers described in the root README.md; this document is for maintainers who deploy or verify the hosted inference layer.
| Demo capability | Space/service |
|---|---|
| Satellite image explanation | lfm_vl_satellite / Tonic/nutonic-lfm-vl-satellite |
| Temporal satellite memory | terramind_tim / Tonic/nutonic-terramind-tim |
| PRO bundle materialization | pro_materialization / NuTonic/nutonic-pro-materialization |
| App data/orchestration | game_server / NuTonic/nutonic-game-server |
| General Street View support | streetview_pano, lfm_vl_hint |
For a competition run-through, deploy or verify the three satellite-focused services first: lfm_vl_satellite, terramind_tim, and pro_materialization.
The workflow .github/workflows/huggingface-deploy.yml runs pytest, then tools/hf_deploy/deploy_space.py, which:
- Stages a Space tree (
pyproject.toml,src/, SpaceREADME.mdfromtemplates/, plus eitherDockerfilefor Docker SDK profiles orapp.pyfor Gradio SDK profiles). - Uses the
hfCLI (fromhuggingface_hub>=1.10, entry pointhf, nothuggingface-cli):hf auth login --token …hf repo create <repo> --repo-type space --space_sdk <space_sdk> --exist-okhf upload <repo> <stagedir> . --repo-type space --delete "*"(full mirror commit)
- Syncs Space variables, secrets, and hardware from
tools/hf_deploy/profiles/<service>.yamlviaHfApi(add_space_variable,add_space_secret,request_space_hardware). The Hub does not yet exposehf spaces secret set; add/update at runtime uses those APIs. - For PRO materialization,
tools/hf_deploy/wait_for_space_runtime.pypolls the Hub until the Space runtime stage settles on RUNNING after Docker build (avoids long blind retries in smoke). - Runs a post-deploy smoke test via
tools/live_inference_smoke.pyand uploads a JSON artifact (hf-smoke-*) per job.
Install locally:
pip install -r tools/hf_deploy/requirements.txt
hf --version
python tools/hf_deploy/deploy_space.py --service lfm_vl_hint --repo-id YOUR_USER/your-space --dry-run| Secret | Purpose |
|---|---|
HF_TOKEN_TONIC |
Write token for Tonic Spaces (LFM hints, TerraMind). |
HF_TOKEN_NUTONIC |
Write token for NuTonic Spaces (game server, PRO materialization). |
HF_TOKEN (optional fallback) |
When HF_TOKEN_TONIC or HF_TOKEN_NUTONIC is unset, the workflow uses HF_TOKEN next, then HF_API_WRITE, for Hub upload auth. Same token is fine if it has write on the target Space repos. |
HF_API_WRITE (optional fallback) |
Used only when org-specific and HF_TOKEN deploy secrets are empty; must be a write-capable Hub token for the Spaces you deploy. |
The deploy step sets runner env HF_TOKEN from GitHub secrets. That variable is empty when none of the configured secrets for that job are defined.
- In the repo: Settings → Secrets and variables → Actions, add
HF_TOKEN_TONICandHF_TOKEN_NUTONIC(recommended), or a singleHF_TOKENas in the table above. - Confirm the token can
hf uploadto the target Space (Tonic/nutonic-lfm-vl-streetview,NuTonic/nutonic-game-server, etc.). - Fork PRs do not receive secrets; deploy jobs are expected to fail or be skipped for untrusted forks unless you use a different policy.
Optional runtime secrets (see profiles/*.yaml — each maps a Hugging Face Space secret key to a repository secret whose value is exported under the same name as an env var in the deploy job):
| Env var on runner (from GitHub secret) | Used for |
|---|---|
TONIC_GOOGLE_MAPS_API_KEY |
Optional Google Street View Static key for the Street View pano Space. Workflow fallback: GOOGLE_MAPS_API_KEY. |
TONIC_LFM_OPENAI_API_KEY |
LFM openai_compatible backend |
TONIC_LFM_OPENAI_BASE_URL |
Optional OpenAI-compatible base URL |
TONIC_LFM_SATELLITE_OPENAI_API_KEY |
Satellite caption openai_compatible backend |
TONIC_LFM_SATELLITE_OPENAI_BASE_URL |
Optional satellite caption OpenAI-compatible base URL |
TONIC_TERRAMIND_HF_TOKEN |
Optional Hub token inside TerraMind Space for model pulls |
NUTONIC_JWT_SECRET |
Game server Space secret JWT_SECRET |
NUTONIC_LEADERBOARD_DATABASE_URL |
SQLAlchemy URL (often secret) |
NUTONIC_RANKED_DATABASE_URL |
Ranked store URL |
NUTONIC_MAPBOX_ACCESS_TOKEN |
PRO materialization → Space secret MAPBOX_ACCESS_TOKEN. If unset, the workflow uses MAPBOX_ACCESS_TOKEN (same token name the worker reads at runtime). |
NUTONIC_INFERENCE_HMAC_SECRET |
PRO worker inbound HMAC (Space secret NUTONIC_INFERENCE_HMAC_SECRET). Required while profiles/pro_materialization.yaml sets NUTONIC_INFERENCE_REQUIRE_INBOUND_HMAC: "1" — otherwise the Space fails startup (RuntimeError in lifespan). Generate a long random string and use the same value on the game server as NUTONIC_INFERENCE_HMAC_SECRET when it calls this worker. Alias in CI: INFERENCE_HMAC_SECRET. |
If an optional secret is unset, that key is skipped (no empty secret pushed).
| Space / service | You likely already have | Add in GitHub Actions (if missing) | Pushed to Space as |
|---|---|---|---|
| All deploy jobs | HF_TOKEN and/or HF_API_WRITE |
HF_TOKEN_TONIC, HF_TOKEN_NUTONIC for separate org tokens |
(auth only — not a Space env) |
| Street View pano | GOOGLE_MAPS_API_KEY if using real Google imagery |
TONIC_GOOGLE_MAPS_API_KEY optional; profile defaults to stub mode |
GOOGLE_MAPS_API_KEY |
| LFM-VL hints | — | TONIC_LFM_OPENAI_API_KEY / TONIC_LFM_OPENAI_BASE_URL only if LFM_VL_BACKEND=openai_compatible (profile default is transformers) |
OPENAI_* |
| LFM-VL satellite | — | TONIC_LFM_SATELLITE_OPENAI_API_KEY / TONIC_LFM_SATELLITE_OPENAI_BASE_URL only if LFM_SATELLITE_BACKEND=openai_compatible (profile default is transformers) |
OPENAI_* |
| TerraMind TiM | HF_API_READ or HF_TOKEN |
TONIC_TERRAMIND_HF_TOKEN for a dedicated read token (optional) |
HF_TOKEN |
| Game server | — | NUTONIC_JWT_SECRET, NUTONIC_LEADERBOARD_DATABASE_URL, NUTONIC_RANKED_DATABASE_URL for real prod (Postgres URLs as needed) |
JWT_SECRET, NUTONIC_LEADERBOARD_DATABASE_URL, NUTONIC_RANKED_DATABASE_URL |
| PRO materialization | MAPBOX_ACCESS_TOKEN |
NUTONIC_INFERENCE_HMAC_SECRET (required with current profile) |
MAPBOX_ACCESS_TOKEN, NUTONIC_INFERENCE_HMAC_SECRET |
Secrets such as GOOGLE_MAPS_API_KEY, NUTONIC_HYDRATION_OUTPUT_DATASET, and GITLEAKS_LICENSE are used by other jobs/scripts, not by huggingface-deploy.yml. Add them only where those workflows or tools read them.
Redeploy everything from Actions: use Actions → huggingface — deploy Spaces → Run workflow, target all, after secrets exist. Pushes to main on paths listed in the workflow also run deploys.
Edit tools/hf_deploy/profiles/<service>.yaml for production defaults:
variables: public Space environment variables (non-secret).secrets: map Space secret name → runner env var name (CI must export the value).space_sdk: optional, defaults todocker. Usegradiofor Hugging Face ZeroGPU services; ZeroGPU is Gradio-SDK only and requires anapp.pyplus decorated GPU functions.hf_space_owner_org: optional Hub namespace prefix for--repo-id(e.g.Tonic). When set,deploy_space.pyexits with an error ifrepo_idis not exactly"{org}/…". The three GPU / ZeroGPU profiles setTonicso those Spaces cannot be deployed under NuTonic by mistake.space_hardware: passed torequest_space_hardware(e.g.zero-a10g,cpu-basic). Requires an account that can request that flavor.sleep_time_seconds: optional;-1means do not sleep on upgraded hardware where supported.
| Service | Default repo_id |
|---|---|
| Street View pano | Tonic/nutonic-streetview-pano |
| LFM-VL hints | Tonic/nutonic-lfm-vl-streetview |
| LFM-VL satellite captions | Tonic/nutonic-lfm-vl-satellite |
| TerraMind TiM | Tonic/nutonic-terramind-tim |
| Game server | NuTonic/nutonic-game-server |
| PRO materialization | NuTonic/nutonic-pro-materialization |