Spaces:
Sleeping
Sleeping
| # Set the OLLAMA_ROOT to a writable directory | |
| export OLLAMA_ROOT=/tmp/ollama | |
| # Start the Ollama server in the background | |
| echo "Starting Ollama server..." | |
| ollama serve & | |
| pid=$! | |
| # Wait for the server to be ready | |
| echo "Waiting for server to start..." | |
| while ! curl -s -o /dev/null http://127.0.0.1:11434; do | |
| echo "Server not yet available, waiting..." | |
| sleep 1 | |
| done | |
| echo "Server is up and running." | |
| # Pull the models | |
| echo "Pulling models..." | |
| ollama pull gemma3:1b | |
| ollama pull gemma3:270m | |
| ollama pull nomic-embed-text | |
| echo "All models pulled." | |
| # Wait for the server process to exit | |
| # This brings the background process to the foreground | |
| wait $pid | |