Download scripts/upload_space_artifacts.py from StarAtNyte1/beam-boot: direct link, hf CLI and curl.
- Browser
- Download file 890 Bytes
-
https://huggingface.co/StarAtNyte1/beam-boot/resolve/main/scripts/upload_space_artifacts.py
- Command line
-
hf download hf://StarAtNyte1/beam-boot/scripts/upload_space_artifacts.py
-
curl -L -o upload_space_artifacts.py https://huggingface.co/StarAtNyte1/beam-boot/resolve/main/scripts/upload_space_artifacts.py
890 Bytes
| """Add reproducibility artifacts to the Space created for this project.""" | |
| import os | |
| from pathlib import Path | |
| import modal | |
| app = modal.App('beamboot-artifacts') | |
| def get_token(): | |
| return os.environ['HUGGINGFACE_TOKEN'] | |
| def main(): | |
| from huggingface_hub import HfApi | |
| api = HfApi(token=get_token.remote()) | |
| repo_id = f"{api.whoami()['name']}/beam-boot" | |
| api.upload_folder(repo_id=repo_id, repo_type='space', folder_path=str(Path('space').resolve()), | |
| allow_patterns=['checkpoint/**', 'beamboot/*.py', 'scripts/*.py', 'pyproject.toml'], | |
| commit_message='Add runnable checkpoint and source') | |
| print(f'Artifacts uploaded: https://huggingface.co/spaces/{repo_id}/tree/main') | |