video-transcriber / Dockerfile
ThreeSixNine's picture
Initial commit: video transcription Space with Whisper + ffmpeg
946b6aa verified
Raw
History Blame Contribute Delete
908 Bytes
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# ffmpeg is required to extract audio from uploaded videos
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg git \
&& rm -rf /var/lib/apt/lists/*
# Run as a non-root user (recommended for Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/home/user/.cache/huggingface
WORKDIR $HOME/app
# Install dependencies first for better layer caching
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Pre-download the Whisper model at build time so the first run is fast
RUN python -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-base')"
COPY --chown=user . .
EXPOSE 7860
CMD ["python", "app.py"]