yamero999 commited on
Commit
2c9f1b8
·
verified ·
1 Parent(s): 8f52560

chore: remove local deployment helper from public space repo

Browse files
Files changed (1) hide show
  1. deploy_to_hf.py +0 -67
deploy_to_hf.py DELETED
@@ -1,67 +0,0 @@
1
- """
2
- Deploy MudraForge Statutory Studio to Hugging Face Spaces
3
- =========================================================
4
- Uses huggingface_hub HfApi to upload the complete hf_space folder.
5
- Strictly zero regex. Zero emojis.
6
- """
7
-
8
- from __future__ import annotations
9
-
10
- import os
11
- from pathlib import Path
12
- import sys
13
-
14
- try:
15
- from huggingface_hub import HfApi, create_repo
16
- except ImportError:
17
- print("Error: huggingface_hub is not installed. Please run: pip install huggingface_hub")
18
- sys.exit(1)
19
-
20
-
21
- def deploy(repo_id: str, token: str):
22
- api = HfApi(token=token)
23
- space_dir = Path(__file__).resolve().parent
24
- print(f"Connecting to Hugging Face API...")
25
- print(f"Target Space: https://huggingface.co/spaces/{repo_id}")
26
-
27
- create_repo(
28
- repo_id=repo_id,
29
- repo_type="space",
30
- space_sdk="gradio",
31
- token=token,
32
- exist_ok=True,
33
- )
34
-
35
- print(f"Uploading files from {space_dir.name}...")
36
- api.upload_folder(
37
- folder_path=str(space_dir),
38
- repo_id=repo_id,
39
- repo_type="space",
40
- token=token,
41
- ignore_patterns=[
42
- "__pycache__/*",
43
- "*.pyc",
44
- "*.pyo",
45
- "deploy_to_hf.py",
46
- "emitted/*",
47
- ".git/*",
48
- ],
49
- )
50
- print(f"SUCCESS: Upload complete.")
51
- print(f"Your live production app is available at: https://huggingface.co/spaces/{repo_id}")
52
-
53
-
54
- if __name__ == "__main__":
55
- if len(sys.argv) >= 3:
56
- target_repo = sys.argv[1]
57
- hf_token = sys.argv[2]
58
- else:
59
- target_repo = os.environ.get("HF_SPACE_REPO", "")
60
- hf_token = os.environ.get("HF_TOKEN", "")
61
-
62
- if not target_repo or not hf_token:
63
- print("Usage: python deploy_to_hf.py <username/space_name> <hf_write_token>")
64
- print("Or set environment variables HF_SPACE_REPO and HF_TOKEN")
65
- sys.exit(1)
66
-
67
- deploy(target_repo, hf_token)