#!/bin/bash # SPARKNET Demo Launcher # Usage: ./run_demo.sh [port] set -e PORT=${1:-8501} SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "🔥 SPARKNET Demo Launcher" echo "=========================" echo "" # Check Python if ! command -v python3 &> /dev/null; then echo "❌ Python3 not found. Please install Python 3.10+" exit 1 fi # Check Streamlit if ! python3 -c "import streamlit" &> /dev/null; then echo "📦 Installing Streamlit..." pip install streamlit fi # Check demo dependencies echo "📦 Checking dependencies..." pip install -q -r "$SCRIPT_DIR/demo/requirements.txt" 2>/dev/null || true # Check Ollama status echo "" echo "🔍 Checking Ollama status..." if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then echo "✅ Ollama is running" MODELS=$(curl -s http://localhost:11434/api/tags | python3 -c "import sys,json; d=json.load(sys.stdin); print(len(d.get('models', [])))" 2>/dev/null || echo "?") echo " Models available: $MODELS" else echo "⚠️ Ollama not running (demo will use simulated responses)" echo " Start with: ollama serve" fi # Launch demo echo "" echo "🚀 Launching SPARKNET Demo on port $PORT..." echo " URL: http://localhost:$PORT" echo "" echo "Press Ctrl+C to stop" echo "=========================" echo "" cd "$SCRIPT_DIR" streamlit run demo/app.py --server.port "$PORT" --server.headless true