File size: 884 Bytes
b6fa5fc
 
 
fbe62f9
b6fa5fc
 
 
 
 
 
 
 
 
 
fbe62f9
b6fa5fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations

import getpass
import os
from pathlib import Path

from huggingface_hub import HfApi


ROOT = Path(__file__).resolve().parent
REPO_ID = "smashburger-dev/Final_Assignment_Template"


def main() -> None:
    token = os.getenv("HF_TOKEN", "").strip() or getpass.getpass("HF token: ").strip()
    if not token:
        raise SystemExit("Missing token")

    api = HfApi(token=token)
    api.upload_folder(
        repo_id=REPO_ID,
        repo_type="space",
        folder_path=str(ROOT),
        ignore_patterns=[
            ".venv/**",
            "__pycache__/**",
            "data/**",
            "answers.local.json",
            "*.pyc",
            ".env",
        ],
        commit_message="Add GAIA Unit 4 workbench",
    )
    print(f"Uploaded to https://huggingface.co/spaces/{REPO_ID}/tree/main")


if __name__ == "__main__":
    main()