Spaces:
Paused
Paused
Download launcher.py from rayhanzuck/cloud: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/spaces/rayhanzuck/cloud/resolve/main/launcher.py
- Command line
-
hf download hf://spaces/rayhanzuck/cloud/launcher.py
-
curl -L -o launcher.py https://huggingface.co/spaces/rayhanzuck/cloud/resolve/main/launcher.py
493 Bytes
| import os | |
| import urllib.request | |
| import subprocess | |
| # URL tempat menyimpan app.py | |
| APP_URL = os.getenv("APP_URL") | |
| # Simpan di /tmp agar tidak ada masalah izin | |
| APP_FILENAME = "/tmp/app.py" | |
| # Download app.py | |
| print(f"Mengunduh {APP_FILENAME} dari {APP_URL}...") | |
| urllib.request.urlretrieve(APP_URL, APP_FILENAME) | |
| # Jalankan Uvicorn dengan app.py dari /tmp | |
| print("Menjalankan aplikasi FastAPI...") | |
| subprocess.run(["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--app-dir", "/tmp"]) | |