skills-cloud / app.py
chenglu's picture
Deploy Skills Cloud
0a75022 verified
Raw History Blame Contribute Delete
1.24 kB
"""Skills Cloud — Gradio entrypoint.
HF Spaces convention: app.py at repo root, importable without side effects
(no launch, no network at import time). Spaces runs this file without
installing the package, so src/ goes on sys.path explicitly.
"""
import sys
from pathlib import Path
_ROOT = Path(__file__).resolve().parent
sys.path.insert(0, str(_ROOT / "src"))
from skills_cloud.skill import load_catalog # noqa: E402
from skills_cloud.ui import build_app # noqa: E402
from skills_cloud.zerogpu import warmup_pipelines # noqa: E402
SKILLS_DIR = _ROOT / "skills"
import os # noqa: E402
print(
f"[skills-cloud] startup: SPACES_ZERO_GPU={bool(os.environ.get('SPACES_ZERO_GPU'))} "
f"OAUTH_CLIENT_ID={bool(os.environ.get('OAUTH_CLIENT_ID'))}",
flush=True,
)
warmup_pipelines() # no-op off ZeroGPU; eager model load on the Space
demo = build_app(load_catalog(SKILLS_DIR))
if __name__ == "__main__":
# ssr_mode=False: Gradio 6.24's SSR renders an empty <main> for this app
# on Spaces (render-heavy UI + OAuth; see the unawaited get_current_user
# warning in Space logs) — visitors got a blank page. Client-side
# rendering works everywhere. Verified live 2026-08-14.
demo.launch(ssr_mode=False)