Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,14 @@ def load_models():
|
|
20 |
st.success("The model has loaded.")
|
21 |
st.session_state['models_loaded'] = True
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def get_correction(input_text):
|
24 |
st.markdown(f'##### Corrected text:')
|
25 |
st.write('')
|
|
|
20 |
st.success("The model has loaded.")
|
21 |
st.session_state['models_loaded'] = True
|
22 |
|
23 |
+
def is_port_in_use(port):
|
24 |
+
import socket
|
25 |
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
26 |
+
return s.connect_ex(('0.0.0.0', port)) == 0
|
27 |
+
|
28 |
+
if 'models_loaded' not in st.session_state:
|
29 |
+
st.session_state['models_loaded'] = False
|
30 |
+
|
31 |
def get_correction(input_text):
|
32 |
st.markdown(f'##### Corrected text:')
|
33 |
st.write('')
|