File size: 661 Bytes
3fe0726
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Start Ollama in the background
ollama serve &

# Wait for Ollama to be ready
echo "Waiting for Ollama to start..."
while ! curl -s http://localhost:11434/api/tags > /dev/null; do
    sleep 1
done
echo "Ollama is ready!"

# Pull the model if it doesn't exist
# We use 'llama3.1' as requested.
MODEL_NAME="llama3.1"
if ! ollama list | grep -q "$MODEL_NAME"; then
    echo "Pulling model $MODEL_NAME..."
    ollama pull $MODEL_NAME
else
    echo "Model $MODEL_NAME already exists."
fi

# Start the FastAPI application
# Using uvicorn on port 7860 (Hugging Face default)
echo "Starting FastAPI app..."
uvicorn src.main:app --host 0.0.0.0 --port 7860