Grinding's picture
Update Dockerfile
4bf9592 verified
raw
history blame contribute delete
827 Bytes
FROM python:3.9-slim
WORKDIR /code
# Copy requirements (make sure it includes soundfile)
COPY ./requirements.txt /code/requirements.txt
# Install system deps for ffmpeg + audio libs
RUN apt-get update && apt-get install -y ffmpeg libsndfile1 && rm -rf /var/lib/apt/lists/*
# Install Python deps
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Use HF_HOME to control transformers cache location
ENV HF_HOME=/code/hf_cache
RUN mkdir -p /code/hf_cache && chmod -R 777 /code/hf_cache
# Pre-download ASR model at build time (so runtime doesn't download/cache)
RUN python - <<'PY'
from transformers import pipeline
pipeline('automatic-speech-recognition', model='distil-whisper/distil-large-v3')
PY
COPY ./app.py /code/app.py
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]