Spaces:
Sleeping
Sleeping
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() |