import threading | |
import subprocess | |
def run_streamlit(): | |
subprocess.run([ | |
"streamlit", "run", "./src/streamlit_app.py", | |
"--server.port", "8501", | |
]) | |
def run_static_files(): | |
subprocess.run( | |
["cd static && npx http-server"], | |
shell=True | |
) | |
if __name__ == "__main__": | |
# Start both servers in separate threads | |
streamlit_thread = threading.Thread(target=run_streamlit) | |
static_files_thread = threading.Thread(target=run_static_files) | |
streamlit_thread.start() | |
static_files_thread.start() | |
# Wait for both servers to finish | |
streamlit_thread.join() | |
static_files_thread.join() |