Al-Alcoba-Inciarte commited on
Commit
709fb85
·
verified ·
1 Parent(s): 3a233d2

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +32 -0
start.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #https://huggingface.co/spaces/MisterAI/Docker_Ollama/
3
+
4
+
5
+ # Set environment variables for optimization HFSpace Free 2CPU - 16GbRAM
6
+ export OMP_NUM_THREADS=2
7
+ export MKL_NUM_THREADS=2
8
+ export CUDA_VISIBLE_DEVICES=-1
9
+
10
+ # Start Ollama in the background
11
+ ollama serve &
12
+
13
+ # Pull the model if not already present
14
+ if ! ollama list | grep -q "deepseek-r1:1.5b"; then
15
+ ollama pull deepseek-r1:1.5b
16
+ fi
17
+
18
+ # Wait for Ollama to start up
19
+ max_attempts=30
20
+ attempt=0
21
+ while ! curl -s http://localhost:11434/api/tags >/dev/null; do
22
+ sleep 1
23
+ attempt=$((attempt + 1))
24
+ if [ $attempt -eq $max_attempts ]; then
25
+ echo "Ollama failed to start within 30 seconds. Exiting."
26
+ exit 1
27
+ fi
28
+ done
29
+
30
+ echo "Ollama is Ready"
31
+
32
+ python app.py