Spaces:
Running
Running
Create start.py
Browse files
start.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# start.py
|
| 2 |
+
import subprocess, sys, os
|
| 3 |
+
|
| 4 |
+
# allow imports from backend/ if needed
|
| 5 |
+
sys.path.insert(0, os.path.join(os.getcwd(), "backend"))
|
| 6 |
+
|
| 7 |
+
print("Running backend/download_models.py ...")
|
| 8 |
+
ret = subprocess.run([sys.executable, "backend/download_models.py"])
|
| 9 |
+
if ret.returncode != 0:
|
| 10 |
+
print("Warning: download_models.py exited non-zero; continuing to start server for debugging...")
|
| 11 |
+
|
| 12 |
+
print("Starting Uvicorn on port 7860 ...")
|
| 13 |
+
subprocess.run([sys.executable, "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"])
|