-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathrun_app.py
More file actions
49 lines (40 loc) · 1.3 KB
/
run_app.py
File metadata and controls
49 lines (40 loc) · 1.3 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
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
Entry point for running the AgentQuant Streamlit application.
"""
import os
import subprocess
import sys
from pathlib import Path
def ensure_directories():
"""Ensure required directories exist"""
# Create figures directory
project_root = Path(__file__).parent
figures_dir = project_root / "figures"
figures_dir.mkdir(exist_ok=True)
print(f"Created figures directory: {figures_dir.absolute()}")
def run_streamlit():
"""Run the Streamlit application"""
# Ensure we're in the correct directory
project_root = Path(__file__).parent
os.chdir(project_root)
# Create required directories
ensure_directories()
# Get the path to the Streamlit app
app_path = project_root / "src" / "app" / "streamlit_app.py"
print(f"Starting Streamlit app: {app_path}")
# Run Streamlit
streamlit_cmd = [
sys.executable, "-m", "streamlit", "run",
str(app_path),
"--server.port", "8501",
"--browser.serverAddress", "localhost",
"--server.headless", "true"
]
try:
subprocess.run(streamlit_cmd)
except KeyboardInterrupt:
print("\nStreamlit app stopped by user")
except Exception as e:
print(f"Error running Streamlit app: {e}")
if __name__ == "__main__":
run_streamlit()