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