|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
PORT=${1:-8501} |
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|
|
|
|
|
echo "π₯ SPARKNET Demo Launcher" |
|
|
echo "=========================" |
|
|
echo "" |
|
|
|
|
|
|
|
|
if ! command -v python3 &> /dev/null; then |
|
|
echo "β Python3 not found. Please install Python 3.10+" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
|
|
|
if ! python3 -c "import streamlit" &> /dev/null; then |
|
|
echo "π¦ Installing Streamlit..." |
|
|
pip install streamlit |
|
|
fi |
|
|
|
|
|
|
|
|
echo "π¦ Checking dependencies..." |
|
|
pip install -q -r "$SCRIPT_DIR/demo/requirements.txt" 2>/dev/null || true |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
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 |
|
|
|