FROM python:3.10-slim # Install system tools and the specific math library required by the wheel RUN apt-get update && apt-get install -y \ wget \ libgomp1 \ libopenblas0 \ libopenblas-dev \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Use the specific HF-optimized CPU wheel (0.3.16) RUN pip install --no-cache-dir \ https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.16-cp310-cp310-linux_x86_64.whl # Download your Kwen model RUN wget -L https://huggingface.co/TheKwenFoundation/Kwen-4B/resolve/main/kwen-4b-q4_k_m.gguf -q -O kwen-4b-q4_k_m.gguf # Standard API requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]