audio_news_agent_demo / startup.sh
kaiku03's picture
Update startup.sh
77e5bee verified
raw
history blame contribute delete
719 Bytes
#!/bin/bash
set -e
# 1. Launch Ollama server in background
ollama serve &
OLLAMA_PID=$!
trap "kill $OLLAMA_PID" EXIT
# 2. Wait until the API port is open
echo "⏳ Waiting for Ollama to become ready..."
for i in {1..30}; do
if curl -s http://localhost:11434 > /dev/null; then
echo "βœ… Ollama is up."
break
else
echo "⏳ Attempt $i: Ollama not ready yet..."
sleep 2
fi
done
if ! curl -s http://localhost:11434 > /dev/null; then
echo "❌ ERROR: Ollama did not start after waiting."
exit 1
fi
# 3. Pull a real model
echo "πŸ“¦ Pulling model: gemma:2b"
ollama pull gemma2:2b || { echo "❌ Failed to pull model"; exit 1; }
# 4. Launch Gradio app
echo "πŸš€ Launching app..."
python main.py