Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,30 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from huggingface_hub import snapshot_download
|
3 |
import os
|
|
|
|
|
|
|
4 |
|
5 |
-
# Download
|
6 |
-
snapshot_download(
|
7 |
-
repo_id="zenefil/veo",
|
8 |
-
repo_type="space",
|
9 |
-
use_auth_token=os.getenv("HF_TOKEN")
|
10 |
)
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
from huggingface_hub import snapshot_download
|
3 |
+
import subprocess
|
4 |
+
import sys
|
5 |
|
6 |
+
# 1) Download private Space
|
7 |
+
LOCAL_DIR = snapshot_download(
|
8 |
+
repo_id="zenefil/veo", # ganti!
|
9 |
+
repo_type="space",
|
10 |
+
use_auth_token=os.getenv("HF_TOKEN"),
|
11 |
)
|
12 |
|
13 |
+
# 2) Path ke skrip Streamlit di private Space
|
14 |
+
streamlit_script = os.path.join(LOCAL_DIR, "src", "streamlit_app.py")
|
15 |
+
|
16 |
+
if not os.path.exists(streamlit_script):
|
17 |
+
print(f"File tidak ditemukan: {streamlit_script}")
|
18 |
+
sys.exit(1)
|
19 |
|
20 |
+
# 3) Jalankan streamlit (replace current process agar log rapi)
|
21 |
+
os.execvp(
|
22 |
+
"streamlit",
|
23 |
+
[
|
24 |
+
"streamlit",
|
25 |
+
"run",
|
26 |
+
streamlit_script,
|
27 |
+
"--server.port", os.getenv("PORT", "7860"),
|
28 |
+
"--server.address", "0.0.0.0",
|
29 |
+
],
|
30 |
+
)
|