Spaces:
Running
Running
Download deploy.py from lerobot/annotation-studio: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/spaces/lerobot/annotation-studio/resolve/main/deploy.py
- Command line
-
hf download hf://spaces/lerobot/annotation-studio/deploy.py
-
curl -L -o deploy.py https://huggingface.co/spaces/lerobot/annotation-studio/resolve/main/deploy.py
2.03 kB
| """Publish the self-contained free-CPU Space with a verified tracked pipeline bundle.""" | |
| import hashlib | |
| import json | |
| import subprocess | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| def main(): | |
| folder = Path(__file__).resolve().parent | |
| root = folder.parents[1] | |
| if subprocess.check_output(["git", "diff", "HEAD", "--", "src", "pyproject.toml"], cwd=root): | |
| raise RuntimeError("Commit or separately package tracked pipeline edits before publishing.") | |
| commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=root, text=True).strip() | |
| archive = folder / "pipeline-source.tar.gz" | |
| subprocess.run( | |
| [ | |
| "git", | |
| "archive", | |
| "--format=tar.gz", | |
| f"--output={archive}", | |
| "HEAD", | |
| "src", | |
| "pyproject.toml", | |
| "LICENSE", | |
| ], | |
| cwd=root, | |
| check=True, | |
| ) | |
| (folder / "pipeline-version.json").write_text( | |
| json.dumps( | |
| { | |
| "git_commit": commit, | |
| "sha256": hashlib.sha256(archive.read_bytes()).hexdigest(), | |
| "preset": "abc_phases_schema_with_original_window_recovery", | |
| "preset_date": "2026-09-25", | |
| }, | |
| indent=2, | |
| ) | |
| + "\n" | |
| ) | |
| api = HfApi() | |
| repo = "lerobot/annotation-studio" | |
| api.create_repo(repo, repo_type="space", space_sdk="docker", private=False, exist_ok=True) | |
| result = api.upload_folder( | |
| repo_id=repo, | |
| repo_type="space", | |
| folder_path=folder, | |
| ignore_patterns=[ | |
| "__pycache__/**", | |
| ".pytest_cache/**", | |
| ".ruff_cache/**", | |
| "*.pyc", | |
| "frontend/node_modules/**", | |
| "frontend/dist/**", | |
| ], | |
| delete_patterns=["app.py"], | |
| commit_message="Always save annotations in standard LeRobot Parquet datasets", | |
| ) | |
| print(f"https://huggingface.co/spaces/{repo}\nRevision: {result.oid}") | |
| if __name__ == "__main__": | |
| main() | |