File size: 946 Bytes
fb52aa0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import subprocess
import sys

def main():
    os.environ["STREAMLIT_CONFIG_DIR"] = os.path.join(os.getcwd(), ".streamlit")
    os.environ["STREAMLIT_BROWSER_GATHER_USAGE_STATS"] = "false"
    os.environ["STREAMLIT_HEADLESS"] = "true"
    os.environ["PYTHONPATH"] = os.getcwd()
    print("Starting SentinelAI Application via Hugging Face Entrypoint...")
    
    # 1. Run Pipeline Orchestrator if data doesn't exist
    if not os.path.exists("data/predictions/explanations.parquet"):
        print("Running pipeline to generate data...")
        subprocess.run([sys.executable, "-m", "src.runtime.orchestrator"], check=True)
        
    # 2. Launch Streamlit
    print("Launching Streamlit Dashboard...")
    subprocess.run([sys.executable, "-m", "streamlit", "run", "src/ui/app.py", "--server.port=7860", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false", "--server.headless=true"])

if __name__ == "__main__":
    main()