#!/bin/sh # 1. Start the Ollama server in the background ollama serve & # 2. Wait for the Ollama server to be up and running echo "Waiting for Ollama server to start..." while ! curl -s http://localhost:11434/ > /dev/null; do sleep 1 done echo "Ollama server is running." # 3. Start the FastAPI gateway server in the foreground # It will listen on port 7860, which is the default for Hugging Face Spaces echo "Starting FastAPI gateway..." uvicorn main:app --host 0.0.0.0 --port 7860