Spaces:
Running
Running
File size: 1,816 Bytes
0a1c5fe 739e423 0a1c5fe 739e423 0a1c5fe 739e423 0a1c5fe 739e423 0a1c5fe 739e423 0a1c5fe 0a46798 0a1c5fe 739e423 0a1c5fe 739e423 0a1c5fe 5224e6a | 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | FROM python:3.10-slim
# ββ System deps ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Rust + cargo needed for DeepFilterNet (df package)
# build-essential needed for speechbrain native extensions
RUN apt-get update && apt-get install -y \
ffmpeg git curl \
build-essential \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& rm -rf /var/lib/apt/lists/*
# Put cargo/rustc on PATH for subsequent RUN steps
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /app
# ββ PyTorch CPU ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
RUN pip install --no-cache-dir torch torchaudio \
--index-url https://download.pytorch.org/whl/cpu
# ββ Core app deps (unchanged from your original) ββββββββββββββββββββββββββββββ
RUN pip install --no-cache-dir \
fastapi uvicorn \
requests \
groq \
deep-translator transformers tokenizers \
huggingface_hub sentencepiece sacremoses \
soundfile noisereduce numpy pyloudnorm \
librosa ffmpeg-python faster-whisper \
cloudinary
COPY . .
RUN useradd -m -u 1000 user
USER user
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV HOME=/home/user
# Pre-download DeepFilterNet weights at build time so first request isn't slow
# (runs as root before USER switch β weights land in /app/.cache)
RUN python -c "from df.enhance import init_df; init_df()" || true
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |