File size: 2,660 Bytes
4b63357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
"""
Launcher script for Inclusive World Curriculum Assistant
"""

import os
import sys
import subprocess
from pathlib import Path

def check_environment():
    """Check if the environment is properly set up"""
    print("πŸ” Checking environment...")
    
    # Check if required files exist
    required_files = ["app.py", "config.py", "utils.py", "requirements.txt"]
    missing_files = []
    
    for file in required_files:
        if not Path(file).exists():
            missing_files.append(file)
    
    if missing_files:
        print(f"❌ Missing required files: {', '.join(missing_files)}")
        return False
    
    # Check if Slides directory exists
    if not Path("Slides").exists():
        print("⚠️  Slides directory not found. Creating...")
        Path("Slides").mkdir(exist_ok=True)
    
    print("βœ… Environment check passed")
    return True

def check_dependencies():
    """Check if dependencies are installed"""
    print("πŸ“¦ Checking dependencies...")
    
    try:
        import streamlit
        import langchain
        import chromadb
        import transformers
        import torch
        import fitz
        print("βœ… All dependencies are installed")
        return True
    except ImportError as e:
        print(f"❌ Missing dependency: {e}")
        print("Please run: pip install -r requirements.txt")
        return False

def start_application():
    """Start the Streamlit application"""
    print("πŸš€ Starting Inclusive World Curriculum Assistant...")
    print("πŸ“– Opening web interface...")
    print("🌐 The application will open in your default browser")
    print("⏳ Please wait for the system to load...")
    print("\n" + "="*50)
    
    try:
        # Start Streamlit
        subprocess.run([
            sys.executable, "-m", "streamlit", "run", "app.py",
            "--server.port", "8501",
            "--server.address", "localhost"
        ])
    except KeyboardInterrupt:
        print("\nπŸ‘‹ Application stopped by user")
    except Exception as e:
        print(f"❌ Error starting application: {e}")

def main():
    """Main launcher function"""
    print("πŸŽ“ Inclusive World Curriculum Assistant")
    print("=" * 50)
    
    # Check environment
    if not check_environment():
        print("\n❌ Environment check failed. Please ensure all files are present.")
        sys.exit(1)
    
    # Check dependencies
    if not check_dependencies():
        print("\n❌ Dependencies check failed. Please install required packages.")
        sys.exit(1)
    
    # Start application
    start_application()

if __name__ == "__main__":
    main()