darshankr commited on
Commit
1715097
·
verified ·
1 Parent(s): 14c798d

Create run.py

Browse files
Files changed (1) hide show
  1. run.py +20 -0
run.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # run.py
2
+ import subprocess
3
+ import sys
4
+
5
+ def main():
6
+ # Start FastAPI server
7
+ api_process = subprocess.Popen([sys.executable, "-m", "uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"])
8
+
9
+ # Start Streamlit server
10
+ streamlit_process = subprocess.Popen([sys.executable, "-m", "streamlit", "run", "app.py"])
11
+
12
+ try:
13
+ api_process.wait()
14
+ streamlit_process.wait()
15
+ except KeyboardInterrupt:
16
+ api_process.terminate()
17
+ streamlit_process.terminate()
18
+
19
+ if __name__ == "__main__":
20
+ main()