-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_app.py
More file actions
36 lines (28 loc) · 1.04 KB
/
Copy pathstart_app.py
File metadata and controls
36 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import subprocess
import sys
import os
def run_streamlit():
"""Start Streamlit app with currently activated environment"""
# Fix OpenMP conflict on macOS
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
# Streamlit app filename
app_file = "user_interface.py" # Change to your app filename
# Check if app file exists
if not os.path.exists(app_file):
print(f"App file '{app_file}' not found!")
print("Please update the filename in run.py")
return
# Build streamlit command
cmd = [sys.executable, "-m", "streamlit", "run", app_file]
print(f"Starting Streamlit app: {app_file}")
print(f"Python path: {sys.executable}")
print(f"Environment: {os.environ.get('VIRTUAL_ENV', 'System Python')}")
print("-" * 50)
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error starting Streamlit: {e}")
except KeyboardInterrupt:
print("\nStreamlit app stopped.")
if __name__ == "__main__":
run_streamlit()