File size: 827 Bytes
7ce9c0c
755a7b4
4bf9592
755a7b4
4bf9592
 
6755aad
4bf9592
 
487c8cb
4bf9592
 
c1c0671
4bf9592
 
 
a35dba6
4bf9592
 
 
 
 
755a7b4
4bf9592
755a7b4
 
4bf9592
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"]