ACOM7 commited on
Commit
2aa957a
·
verified ·
1 Parent(s): 3cea990

Delete deploy_space.py

Browse files
Files changed (1) hide show
  1. deploy_space.py +0 -48
deploy_space.py DELETED
@@ -1,48 +0,0 @@
1
- import os
2
- import sys
3
- import time
4
- from pathlib import Path
5
- from huggingface_hub import HfApi
6
-
7
- # Try loading HF_TOKEN from environment or ~/.env file
8
- token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
9
-
10
- if not token:
11
- env_file = Path.home() / ".env"
12
- if env_file.exists():
13
- for line in env_file.read_text().splitlines():
14
- if line.startswith("HF_TOKEN="):
15
- token = line.split("=", 1)[1].strip().strip('"').strip("'")
16
- break
17
-
18
- if not token:
19
- print("MISSING_TOKEN")
20
- sys.exit(1)
21
-
22
- api = HfApi(token=token)
23
- repo_id = "Aeonicc/anysplat-gpu"
24
-
25
- print(f"Uploading app.py to Space {repo_id}...")
26
- api.upload_file(
27
- path_or_fileobj="app.py",
28
- path_in_repo="app.py",
29
- repo_id=repo_id,
30
- repo_type="space",
31
- commit_message="Fix ZeroGPU device allocation, Gradio 5 gallery dict parsing, and launch parameters"
32
- )
33
- print("Upload successful!")
34
-
35
- print("Checking Space build and runtime status...")
36
- for i in range(30):
37
- info = api.get_space_runtime(repo_id)
38
- stage = info.stage
39
- print(f"Status check {i+1}: stage = {stage}")
40
- if stage == "RUNNING":
41
- print("Space is RUNNING and READY!")
42
- sys.exit(0)
43
- elif stage in ["BUILD_ERROR", "RUNTIME_ERROR", "CONFIG_ERROR"]:
44
- print(f"Space encountered error: {stage}")
45
- sys.exit(2)
46
- time.sleep(5)
47
-
48
- print("Space is building, please allow a few moments.")