apivietchu / scripts /deploy_hf_space.py
tranvanhung203's picture
Deploy Docker Space
c3db5da verified
Raw
History Blame Contribute Delete
805 Bytes
import os
from pathlib import Path
from huggingface_hub import HfApi
REPO_ID = "tranvanhung203/apivietchu"
ROOT = Path(__file__).resolve().parents[1]
def main() -> None:
token = os.environ.get("HF_TOKEN")
if not token:
raise SystemExit("HF_TOKEN is not set")
api = HfApi(token=token)
api.upload_folder(
repo_id=REPO_ID,
repo_type="space",
folder_path=str(ROOT),
ignore_patterns=[
".git/*",
".venv/*",
"__pycache__/*",
".cache/huggingface/*",
"app/models/*",
"app/math_symbol_data/*",
],
delete_patterns="*",
commit_message="Deploy Docker Space",
)
print(f"https://huggingface.co/spaces/{REPO_ID}")
if __name__ == "__main__":
main()