amogneandualem commited on
Commit
fa6a201
·
verified ·
1 Parent(s): b59d441

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +8 -1
start.sh CHANGED
@@ -1,17 +1,24 @@
1
  #!/bin/bash
2
 
 
3
  export OLLAMA_HOST=0.0.0.0
 
 
4
  echo "Starting Ollama server in background (listening on $OLLAMA_HOST:11434)..."
5
  ollama serve &
6
 
 
7
  echo "Waiting 45 seconds for Ollama server to fully initialize..."
8
  sleep 45
9
 
 
10
  MODEL="moondream:1.8b"
11
  echo "Ensuring model $MODEL is pulled and ready..."
 
 
12
  ollama pull "$MODEL"
13
  ollama run "$MODEL" "Describe a house" --verbose --system "You are a helpful assistant." --keep < /dev/null
14
 
 
15
  echo "Starting Gradio application on port 7860..."
16
- # Launch Gradio app directly using Python
17
  exec python app.py
 
1
  #!/bin/bash
2
 
3
+ # 1. Set the OLLAMA_HOST to listen on all interfaces (CRITICAL NETWORK FIX for Docker)
4
  export OLLAMA_HOST=0.0.0.0
5
+
6
+ # 2. Start Ollama in the background
7
  echo "Starting Ollama server in background (listening on $OLLAMA_HOST:11434)..."
8
  ollama serve &
9
 
10
+ # 3. Wait for the Ollama server process to initialize
11
  echo "Waiting 45 seconds for Ollama server to fully initialize..."
12
  sleep 45
13
 
14
+ # 4. Pull and CONFIRM MODEL READINESS (Pre-load the model)
15
  MODEL="moondream:1.8b"
16
  echo "Ensuring model $MODEL is pulled and ready..."
17
+
18
+ # Pull and force a synchronous run to load the model into VRAM
19
  ollama pull "$MODEL"
20
  ollama run "$MODEL" "Describe a house" --verbose --system "You are a helpful assistant." --keep < /dev/null
21
 
22
+ # 5. Start the Gradio web application
23
  echo "Starting Gradio application on port 7860..."
 
24
  exec python app.py