Spaces:
Paused
Paused
Download start.sh from msradam/desirepath: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/msradam/desirepath/resolve/main/start.sh
- Command line
-
hf download hf://spaces/msradam/desirepath/start.sh
-
curl -L -o start.sh https://huggingface.co/spaces/msradam/desirepath/resolve/main/start.sh
1.12 kB
| # Ollama in the background, the app in the foreground on the port Spaces expect. | |
| set -e | |
| ollama serve & | |
| # Wait for the daemon rather than racing it. A Space that starts serving before | |
| # the model is loadable answers its first queries with "Ollama unreachable". | |
| i=0 | |
| until curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; do | |
| i=$((i + 1)) | |
| if [ "$i" -gt 120 ]; then | |
| echo "ollama did not come up within 120s; serving the app anyway so the" | |
| echo "coverage screen still works and the router can fall back to WebGPU." | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| # Resident before the first visitor, so nobody pays the load. In the | |
| # background, because loading 2.1 GB is slow on a CPU Space and the app has to | |
| # be listening on $PORT before the platform's startup window closes. The | |
| # coverage screen needs no model at all, so it should not wait for one. | |
| ( | |
| curl -sf http://127.0.0.1:11434/api/generate \ | |
| -d '{"model":"granite4:micro","keep_alive":"-1"}' >/dev/null 2>&1 \ | |
| && echo "model resident" \ | |
| || echo "model warm-up failed; first query will pay the load" | |
| ) & | |
| exec node /app/server.mjs | |