-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
39 lines (30 loc) · 1.04 KB
/
start.sh
File metadata and controls
39 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e
MODEL="${MODEL_NAME:-qwen2.5-coder:7b}"
echo "================================================"
echo " AI Assignment Grader — Starting up"
echo "================================================"
export OLLAMA_HOST=0.0.0.0:11434
export OLLAMA_ORIGINS=*
export OLLAMA_KEEP_ALIVE=-1
echo "[1/3] Starting Ollama server..."
ollama serve &
echo "[2/3] Waiting for Ollama..."
MAX_WAIT=60; COUNT=0
until curl -s http://localhost:11434 > /dev/null 2>&1; do
[ $COUNT -ge $MAX_WAIT ] && echo "ERROR: Ollama did not start" && exit 1
sleep 1; COUNT=$((COUNT+1))
echo " ...waiting ($COUNT/${MAX_WAIT}s)"
done
echo " Ollama ready!"
echo "[3/3] Pulling model: $MODEL"
ollama pull "$MODEL"
echo "Warming up model..."
curl -s http://localhost:11434/api/generate \
-d "{\"model\": \"$MODEL\", \"prompt\": \"\", \"keep_alive\": -1}" > /dev/null
echo "Model warm."
echo ""
echo "================================================"
echo " Launching Gradio on port 7860"
echo "================================================"
exec python app.py