Download app.py from ThisIsAnAnonymousUser/Minimal-Maximal.7.0: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/ThisIsAnAnonymousUser/Minimal-Maximal.7.0/resolve/main/app.py
- Command line
-
hf download hf://spaces/ThisIsAnAnonymousUser/Minimal-Maximal.7.0/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ThisIsAnAnonymousUser/Minimal-Maximal.7.0/resolve/main/app.py
1.15 kB
| import os | |
| import sys | |
| import zipfile | |
| import shutil | |
| from huggingface_hub import hf_hub_download | |
| CODE_REPO = "ThisIsAnAnonymousUser/minmax-code-private" | |
| CODE_ZIP = "private_app_demeaned.zip" | |
| def load_private_app(): | |
| token = os.getenv("HF_TOKEN") | |
| if not token: | |
| raise RuntimeError("HF_TOKEN secret missing. Add it in Space Settings → Secrets.") | |
| zip_path = hf_hub_download( | |
| repo_id=CODE_REPO, | |
| filename=CODE_ZIP, | |
| repo_type="dataset", | |
| token=token, | |
| ) | |
| extract_dir = "/tmp/private_app_demeaned" | |
| if os.path.exists(extract_dir): | |
| shutil.rmtree(extract_dir) | |
| os.makedirs(extract_dir, exist_ok=True) | |
| with zipfile.ZipFile(zip_path, "r") as z: | |
| z.extractall(extract_dir) | |
| sys.path.insert(0, extract_dir) | |
| # This requires: private_app_demeaned.py at the ZIP ROOT | |
| import private_app_demeaned | |
| return private_app_demeaned | |
| private_app_demeaned = load_private_app() | |
| demo = private_app_demeaned.demo | |
| if __name__ == "__main__": | |
| demo.queue() | |
| port = int(os.environ.get("PORT", "7860")) | |
| demo.launch(server_name="0.0.0.0", server_port=port, ssr_mode=False) |