Dark-O-Ether commited on
Commit
9539210
·
1 Parent(s): 2e7b88d

testing v-0.0.5

Browse files
Files changed (3) hide show
  1. app.py +6 -1
  2. init.sh +1 -1
  3. init2.sh +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ import streamlit as st
4
  import os
5
  import stat
6
  import socket
7
- # import time
8
 
9
  # Get current permissions and add the execute bit for the owner
10
  current_permissions = os.stat("init.sh").st_mode
@@ -38,6 +38,11 @@ if env_var not in os.environ:
38
  print(result.stdout)
39
  # st.write("Script output:")
40
  # st.write(result.stdout)
 
 
 
 
 
41
  except subprocess.CalledProcessError as e:
42
  print("An error occurred:")
43
  print(e.stderr)
 
4
  import os
5
  import stat
6
  import socket
7
+ import time
8
 
9
  # Get current permissions and add the execute bit for the owner
10
  current_permissions = os.stat("init.sh").st_mode
 
38
  print(result.stdout)
39
  # st.write("Script output:")
40
  # st.write(result.stdout)
41
+ while not is_port_in_use(host, port):
42
+ print(f"Not listening on port: {host}:{port}")
43
+ print("Waiting 10 seconds before retrying...")
44
+ time.sleep(10)
45
+ print(f"Listening on port: {host}:{port}")
46
  except subprocess.CalledProcessError as e:
47
  print("An error occurred:")
48
  print(e.stderr)
init.sh CHANGED
@@ -40,5 +40,5 @@ cd build
40
 
41
  echo "llama-server launched. Waiting for the server to initialize..."
42
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
43
- sleep 15
44
  echo "Initialization complete. Proceeding with Streamlit app startup..."
 
40
 
41
  echo "llama-server launched. Waiting for the server to initialize..."
42
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
43
+ sleep 45
44
  echo "Initialization complete. Proceeding with Streamlit app startup..."
init2.sh CHANGED
@@ -17,7 +17,7 @@ if [ -d "llama.cpp" ]; then
17
 
18
  echo "llama-server launched. Waiting for the server to initialize..."
19
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
20
- sleep 15
21
  echo "Initialization complete. Proceeding with Streamlit app startup..."
22
  else
23
  echo "Directory 'build' not found inside 'llama.cpp'"
@@ -41,7 +41,7 @@ elif [ "$(basename "$PWD")" = "llama.cpp" ]; then
41
 
42
  echo "llama-server launched. Waiting for the server to initialize..."
43
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
44
- sleep 15
45
  echo "Initialization complete. Proceeding with Streamlit app startup..."
46
  else
47
  echo "Directory 'build' not found in the current 'llama.cpp' folder"
 
17
 
18
  echo "llama-server launched. Waiting for the server to initialize..."
19
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
20
+ sleep 45
21
  echo "Initialization complete. Proceeding with Streamlit app startup..."
22
  else
23
  echo "Directory 'build' not found inside 'llama.cpp'"
 
41
 
42
  echo "llama-server launched. Waiting for the server to initialize..."
43
  # (Optional) Wait a few seconds for the server to start before launching Streamlit
44
+ sleep 45
45
  echo "Initialization complete. Proceeding with Streamlit app startup..."
46
  else
47
  echo "Directory 'build' not found in the current 'llama.cpp' folder"