Spaces:
Running on Zero
Running on Zero
| """Free external wake-up client for SEED's Gradio API. | |
| Environment variables: | |
| SEED_SPACE_URL=https://italianhype-seed-autonomous-unicorn.hf.space | |
| SEED_TRIGGER_SECRET=... | |
| HF_TOKEN=hf_... # caller token used for ZeroGPU quota and private Spaces | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| import requests | |
| space_url = os.environ.get("SEED_SPACE_URL", "").rstrip("/") | |
| trigger_secret = os.environ.get("SEED_TRIGGER_SECRET", "") | |
| hf_token = os.environ.get("HF_TOKEN", "") | |
| if not space_url: | |
| raise SystemExit("SEED_SPACE_URL is required") | |
| headers = {"Content-Type": "application/json"} | |
| if hf_token: | |
| headers["Authorization"] = f"Bearer {hf_token}" | |
| response = requests.post( | |
| f"{space_url}/gradio_api/call/autonomous_cycle", | |
| headers=headers, | |
| json={"data": [trigger_secret, False]}, | |
| timeout=30, | |
| ) | |
| response.raise_for_status() | |
| print(response.text) | |
| sys.exit(0) | |