Spaces:
Runtime error
Runtime error
# Start Ollama in the background | |
ollama serve & | |
# Pull the TinyLlama model | |
ollama pull tinyllama | |
# Wait for Ollama to start | |
max_attempts=30 | |
attempt=0 | |
while ! curl -s http://localhost:11434/api/tags >/dev/null; do | |
sleep 1 | |
attempt=$((attempt + 1)) | |
if [ $attempt -eq $max_attempts ]; then | |
echo "Ollama failed to start within 30 seconds. Exiting." | |
exit 1 | |
fi | |
done | |
echo "Ollama is ready." | |
# Set Ngrok auth token from environment variable | |
ngrok authtoken $NGROK_AUTH_TOKEN | |
# Start Ngrok to tunnel the Ollama server | |
ngrok http 11434 |