File size: 2,027 Bytes
83e1c23 6a8a419 83e1c23 6a8a419 9483be8 83e1c23 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | """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()
|