FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PORT=7860 \ HOME=/home/user \ HF_HOME=/home/user/.cache/huggingface WORKDIR /app COPY requirements.txt ./ # The CPU wheel index prevents a CUDA runtime from being included in this # CPU-only Space. The qwen-asr 0.0.6 transformer backend is vendored under # server_runtime, avoiding its unrelated ASR UI and alignment dependencies. RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.9.1 && \ pip install --no-cache-dir -r requirements.txt # Pin both remote bases at build time. Runtime loading names exact revisions, # so a request cannot silently move to a different model version. RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('Qwen/Qwen3-ASR-0.6B', revision='5eb144179a02acc5e5ba31e748d22b0cf3e303b0'); snapshot_download('laion/clap-htsat-unfused', revision='8fa0f1c6d0433df6e97c127f64b2a1d6c0dcda8a')" RUN useradd --create-home --uid 1000 user && \ mkdir -p /home/user/.cache/huggingface && \ chown -R user:user /home/user COPY --chown=1000:1000 . . USER user EXPOSE 7860 CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT} --no-access-log"]