Spaces:
Runtime error
Runtime error
Update run.py
Browse files
run.py
CHANGED
@@ -1,27 +1,8 @@
|
|
1 |
-
# run.py
|
2 |
-
import subprocess
|
3 |
-
import sys
|
4 |
import os
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
port = int(os.environ.get("PORT", 7860)) # Hugging Face Spaces uses port 7860
|
9 |
-
streamlit_process = subprocess.Popen([
|
10 |
-
sys.executable,
|
11 |
-
"-m",
|
12 |
-
"streamlit",
|
13 |
-
"run",
|
14 |
-
"app.py",
|
15 |
-
"--server.port",
|
16 |
-
str(port),
|
17 |
-
"--server.address",
|
18 |
-
"0.0.0.0"
|
19 |
-
])
|
20 |
-
|
21 |
-
try:
|
22 |
-
streamlit_process.wait()
|
23 |
-
except KeyboardInterrupt:
|
24 |
-
streamlit_process.terminate()
|
25 |
|
26 |
if __name__ == "__main__":
|
27 |
-
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import sys
|
3 |
+
import uvicorn
|
4 |
+
from app import create_app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
if __name__ == "__main__":
|
7 |
+
port = int(os.environ.get("PORT", 7860))
|
8 |
+
uvicorn.run(create_app(), host="0.0.0.0", port=port)
|