Spaces:
Running
Running
| import os | |
| from huggingface_hub import snapshot_download | |
| import subprocess | |
| import sys | |
| # 1) Download private Space | |
| LOCAL_DIR = snapshot_download( | |
| repo_id="zenefil/veo", # ganti! | |
| repo_type="space", | |
| use_auth_token=os.getenv("HF_TOKEN"), | |
| ) | |
| # 2) Path ke skrip Streamlit di private Space | |
| streamlit_script = os.path.join(LOCAL_DIR, "src", "streamlit_app.py") | |
| if not os.path.exists(streamlit_script): | |
| print(f"File tidak ditemukan: {streamlit_script}") | |
| sys.exit(1) | |
| # 3) Jalankan streamlit (replace current process agar log rapi) | |
| os.execvp( | |
| "streamlit", | |
| [ | |
| "streamlit", | |
| "run", | |
| streamlit_script, | |
| "--server.port", os.getenv("PORT", "7860"), | |
| "--server.address", "0.0.0.0", | |
| ], | |
| ) | |