# nlp-asr-kit — Whisper small + Qwen2.5-0.5B-Instruct Q4 GGUF # Optimized for Hugging Face Spaces (free CPU tier, glibc/Debian) FROM python:3.10 # ffmpeg for audio decoding (faster-whisper) # build-essential + cmake needed to compile llama-cpp-python for glibc RUN apt-get update && apt-get install -y \ ffmpeg \ build-essential \ cmake \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" ENV HF_HOME="/home/user/.cache/huggingface" WORKDIR /app COPY --chown=user ./requirements.txt requirements.txt # Compile llama-cpp-python for CPU on glibc (Debian) # MAKE_JOBS=1 limits parallelism to prevent OOMKilled during compilation # This takes ~5 min but is the only reliable way on glibc containers RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \ MAKE_JOBS=1 \ pip install --no-cache-dir --user llama-cpp-python==0.2.90 RUN pip install --no-cache-dir --user -r requirements.txt COPY --chown=user . /app CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]