Spaces:
Build error
Build error
# Function to pull and run a model | |
pull_and_run_model() { | |
local model_name=$1 | |
echo "Pulling $model_name" | |
ollama pull "$model_name" | |
echo "Running $model_name" | |
ollama run "$model_name" --keepalive -1s & | |
} | |
# Starting server | |
echo "Starting server" | |
ollama serve & | |
sleep 5 # Allowing time for the server to start | |
# Splitting the models by comma and processing each | |
IFS=',' read -ra MODELS <<< "$model" | |
for m in "${MODELS[@]}"; do | |
pull_and_run_model "$m" | |
sleep 5 # Optional: Delay between starting each model | |
done | |
# Keep the script running to prevent the container from exiting | |
wait |