| # Start Ollama service in the background | |
| ollama serve & | |
| # Wait for Ollama to be ready | |
| sleep 5 | |
| # Pull the required embedding model | |
| echo "Pulling nomic-embed-text..." | |
| ollama pull nomic-embed-text | |
| # Pull the small LLM for generating responses (llama3.2:1b) | |
| echo "Pulling llama3.2:1b... (Lightweight model for HF Free Tier)" | |
| ollama pull llama3.2:1b | |
| # Start the FastAPI server on port 7860 (default for HF Spaces) | |
| echo "Starting Application..." | |
| uvicorn main:app --host 0.0.0.0 --port 7860 | |