#!/bin/bash echo "Starting Ollama server in background..." ollama serve & echo "Waiting for Ollama to initialize..." sleep 10 until curl -s http://localhost:11434/api/tags > /dev/null; do echo "Ollama not ready yet, waiting..." sleep 5 done echo "Ollama is ready!" MODEL_NAME="gemma3:1b" echo "Pulling Ollama model: ${MODEL_NAME}..." ollama pull "${MODEL_NAME}" || { echo "Failed to pull model ${MODEL_NAME}. Exiting."; exit 1; } echo "Starting Streamlit app..." streamlit run streamlit_app.py --server.port=8501 --server.enableCORS=false --server.enableXsrfProtection=false # Keep the script running so the container doesn't exit if streamlit dies wait