Update BrainBot.py
Browse files- BrainBot.py +12 -0
BrainBot.py
CHANGED
@@ -10,6 +10,18 @@ with open('styles.css') as f:
|
|
10 |
|
11 |
st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
## FUNCTIONS
|
14 |
## -------------------------------------------------------------------------------------------
|
15 |
# Function to save the uploaded file as a temporary file and return its path.
|
|
|
10 |
|
11 |
st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)
|
12 |
|
13 |
+
## SERVER SETUP
|
14 |
+
## -------------------------------------------------------------------------------------------
|
15 |
+
def start_server():
|
16 |
+
os.system("uvicorn main:app --host 0.0.0.0 --port 7860")
|
17 |
+
st.session_state['server_started'] = True
|
18 |
+
|
19 |
+
if 'server_started' not in st.session_state:
|
20 |
+
st.session_state['server_started'] = False
|
21 |
+
|
22 |
+
if not st.session_state['server_started']:
|
23 |
+
start_server()
|
24 |
+
|
25 |
## FUNCTIONS
|
26 |
## -------------------------------------------------------------------------------------------
|
27 |
# Function to save the uploaded file as a temporary file and return its path.
|