#!/usr/bin/env python3
"""
Simple script to run the BerryRAG Streamlit interface
"""
import subprocess
import sys
import os
from pathlib import Path
def main():
"""Run the Streamlit app"""
# Check if we're in the right directory
if not Path("streamlit_app.py").exists():
print("❌ Error: streamlit_app.py not found in current directory")
print("Please run this script from the berry-rag project root directory")
sys.exit(1)
# Check if streamlit is installed
try:
import streamlit
print("✅ Streamlit is installed")
except ImportError:
print("❌ Streamlit not found. Installing dependencies...")
subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True)
print("✅ Dependencies installed")
print("🍓 Starting BerryRAG Streamlit Interface...")
print("📱 The app will open in your default web browser")
print("🔗 If it doesn't open automatically, go to: http://localhost:8501")
print("⏹️ Press Ctrl+C to stop the server")
print("-" * 60)
# Run streamlit
try:
subprocess.run([
sys.executable, "-m", "streamlit", "run", "streamlit_app.py",
"--server.headless", "false",
"--server.port", "8501",
"--browser.gatherUsageStats", "false"
], check=True)
except KeyboardInterrupt:
print("\n🛑 Streamlit server stopped")
except subprocess.CalledProcessError as e:
print(f"❌ Error running Streamlit: {e}")
sys.exit(1)
if __name__ == "__main__":
main()