Spaces:
Runtime error
Runtime error
Danil
commited on
Commit
Β·
46b04e0
1
Parent(s):
6b9151e
app.py
CHANGED
|
@@ -4,18 +4,10 @@ import os
|
|
| 4 |
import json
|
| 5 |
|
| 6 |
def start_server():
|
| 7 |
-
os.system("uvicorn server:app --port 8080 --host 0.0.0.0 --workers
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
-
import socket
|
| 12 |
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
| 13 |
-
return s.connect_ex(('0.0.0.0', port)) == 0
|
| 14 |
-
|
| 15 |
-
if 'server_started' not in st.session_state:
|
| 16 |
-
st.session_state['server_started'] = False
|
| 17 |
-
|
| 18 |
-
if not st.session_state['server_started']:
|
| 19 |
start_server()
|
| 20 |
|
| 21 |
st.set_page_config(
|
|
|
|
| 4 |
import json
|
| 5 |
|
| 6 |
def start_server():
|
| 7 |
+
os.system("uvicorn server:app --port 8080 --host 0.0.0.0 --workers 1")
|
| 8 |
+
os.environ["SSTART"] = True
|
| 9 |
|
| 10 |
+
if os.environ.get('SSTART') is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
start_server()
|
| 12 |
|
| 13 |
st.set_page_config(
|