File size: 737 Bytes
709fb85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
#https://huggingface.co/spaces/MisterAI/Docker_Ollama/


# Set environment variables for optimization HFSpace Free 2CPU - 16GbRAM
export OMP_NUM_THREADS=2
export MKL_NUM_THREADS=2
export CUDA_VISIBLE_DEVICES=-1

# Start Ollama in the background
ollama serve &

# Pull the model if not already present
if ! ollama list | grep -q "deepseek-r1:1.5b"; then
    ollama pull deepseek-r1:1.5b
fi

# Wait for Ollama to start up
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"

python app.py