File size: 1,422 Bytes
d520909 |
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 |
#!/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
|