Download deploy_to_hf.py from smashburger-dev/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/spaces/smashburger-dev/Final_Assignment_Template/resolve/main/deploy_to_hf.py
- Command line
-
hf download hf://spaces/smashburger-dev/Final_Assignment_Template/deploy_to_hf.py
-
curl -L -o deploy_to_hf.py https://huggingface.co/spaces/smashburger-dev/Final_Assignment_Template/resolve/main/deploy_to_hf.py
884 Bytes
| from __future__ import annotations | |
| import getpass | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| ROOT = Path(__file__).resolve().parent | |
| REPO_ID = "smashburger-dev/Final_Assignment_Template" | |
| def main() -> None: | |
| token = os.getenv("HF_TOKEN", "").strip() or getpass.getpass("HF token: ").strip() | |
| if not token: | |
| raise SystemExit("Missing token") | |
| api = HfApi(token=token) | |
| api.upload_folder( | |
| repo_id=REPO_ID, | |
| repo_type="space", | |
| folder_path=str(ROOT), | |
| ignore_patterns=[ | |
| ".venv/**", | |
| "__pycache__/**", | |
| "data/**", | |
| "answers.local.json", | |
| "*.pyc", | |
| ".env", | |
| ], | |
| commit_message="Add GAIA Unit 4 workbench", | |
| ) | |
| print(f"Uploaded to https://huggingface.co/spaces/{REPO_ID}/tree/main") | |
| if __name__ == "__main__": | |
| main() | |