MisterAI commited on
Commit
d73bb73
·
verified ·
1 Parent(s): d370c1c

Create start.sh

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