aijunkie2025 commited on
Commit
a73c1d3
·
verified ·
1 Parent(s): c4343dc

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -55
app.py DELETED
@@ -1,55 +0,0 @@
1
- # app.py (Space publik)
2
- import os
3
- from huggingface_hub import snapshot_download
4
- import sys
5
-
6
- # ---- 1) Set ENV sebelum Streamlit jalan (W A J I B) ----
7
- # HOME yang writable (agar tidak tulis ke '/.streamlit')
8
- os.environ.setdefault("HOME", "/home/user")
9
- # Matikan XSRF/CORS + naikan limit upload
10
- os.environ.setdefault("STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION", "false")
11
- os.environ.setdefault("STREAMLIT_SERVER_ENABLE_CORS", "false")
12
- os.environ.setdefault("STREAMLIT_BROWSER_GATHER_USAGE_STATS", "false")
13
- os.environ.setdefault("STREAMLIT_SERVER_MAX_UPLOAD_SIZE", "1024")
14
-
15
- # (opsional) siapkan config.toml sebagai backup
16
- try:
17
- cfg_dir = os.path.join(os.environ["HOME"], ".streamlit")
18
- os.makedirs(cfg_dir, exist_ok=True)
19
- cfg_path = os.path.join(cfg_dir, "config.toml")
20
- if not os.path.exists(cfg_path):
21
- with open(cfg_path, "w", encoding="utf-8") as f:
22
- f.write(
23
- "[server]\n"
24
- "enableXsrfProtection = false\n"
25
- "enableCORS = false\n"
26
- "maxUploadSize = 1024\n"
27
- "\n[browser]\n"
28
- "gatherUsageStats = false\n"
29
- )
30
- except Exception:
31
- pass
32
-
33
- # ---- 2) Download Space privat ----
34
- LOCAL_DIR = snapshot_download(
35
- repo_id="zenefil/veo", # <== pastikan benar
36
- repo_type="space",
37
- use_auth_token=os.getenv("HF_TOKEN"),
38
- )
39
-
40
- # ---- 3) Jalankan streamlit script dari Space privat ----
41
- streamlit_script = os.path.join(LOCAL_DIR, "src", "streamlit_app.py")
42
- if not os.path.exists(streamlit_script):
43
- print(f"File tidak ditemukan: {streamlit_script}")
44
- sys.exit(1)
45
-
46
- os.execvp(
47
- "streamlit",
48
- [
49
- "streamlit",
50
- "run",
51
- streamlit_script,
52
- "--server.address", "0.0.0.0",
53
- "--server.port", os.getenv("PORT", "7860"),
54
- ],
55
- )