JSCPPProgrammer's picture
chore: sync local Space files
f3a60a0 verified
"""One-shot upload of this folder to the Hugging Face Space (uses HF_TOKEN or cached login)."""
from __future__ import annotations
import os
import sys
from pathlib import Path
# Project root: anima-gradio-zerogpu-space/
ROOT = Path(__file__).resolve().parent.parent
REPO_ID = os.environ.get("HF_SPACE_REPO_ID", "JSCPPProgrammer/anima-gradio-zerogpu-space")
def main() -> int:
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
repo_id=REPO_ID,
folder_path=str(ROOT),
repo_type="space",
commit_message=os.environ.get("HF_COMMIT_MESSAGE", "chore: sync local Space files"),
ignore_patterns=[
".git",
".git/**",
".pytest_cache",
".pytest_cache/**",
".mypy_cache",
".mypy_cache/**",
".venv",
".venv/**",
"__pycache__",
"__pycache__/**",
"*.pyc",
".env",
".env.*",
"*.log",
"*.part",
"ComfyUI/.git",
"ComfyUI/.git/**",
"ComfyUI/models",
"ComfyUI/models/**",
"ComfyUI/output",
"ComfyUI/output/**",
"ComfyUI/temp",
"ComfyUI/temp/**",
"ComfyUI/input",
"ComfyUI/input/**",
"ComfyUI/user",
"ComfyUI/user/**",
"ComfyUI/**/__pycache__",
"ComfyUI/**/__pycache__/**",
"ComfyUI/**/*.pyc",
],
)
print(f"Uploaded {ROOT} to https://huggingface.co/spaces/{REPO_ID}", file=sys.stderr)
return 0
if __name__ == "__main__":
raise SystemExit(main())