#!/bin/bash # Exit on error set -e echo "🚀 Starting Cognitive AI Tutor..." # Start Ollama in background echo "📥 Starting Ollama service..." ollama serve & OLLAMA_PID=$! # Wait for Ollama to be ready echo "⏳ Waiting for Ollama to be ready..." sleep 10 # Pull TinyLlama model (if not already present) echo "📦 Downloading TinyLlama model..." ollama pull tinyllama || echo "Warning: Could not pull TinyLlama, continuing..." # Pull Phi-2 as fallback (smaller, faster) echo "📦 Downloading Phi-2 model as fallback..." ollama pull phi || echo "Warning: Could not pull Phi-2" # Start the Streamlit app echo "🌐 Starting Streamlit web interface..." streamlit run app.py \ --server.port=7860 \ --server.address=0.0.0.0 \ --server.headless=true \ --server.enableCORS=false \ --server.enableXsrfProtection=false \ --theme.base="light" \ --browser.gatherUsageStats=false # Keep container running wait $OLLAMA_PID