ayn / Dockerfile
AndreaNotes1's picture
Upload 12 files
475aa1b verified
Raw History Blame Contribute Delete
1.29 kB
FROM python:3.11-slim
WORKDIR /app
# wget is needed once, at build time, to download the Piper voice model
RUN apt-get update && apt-get install -y --no-install-recommends wget \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Bake Ms. Q's voice model into the image so TTS never depends on an
# external network call at runtime (see tts.py for why this matters).
# ~63 MB, downloaded once at build time from Hugging Face's model hub.
RUN mkdir -p /app/voices && \
wget -q -O /app/voices/en_US-lessac-medium.onnx \
https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx && \
wget -q -O /app/voices/en_US-lessac-medium.onnx.json \
https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json
# Same idea for the document-RAG embedding model: download it once at build
# time so it's baked into the image rather than fetched on a live request.
RUN python3 -c "from fastembed import TextEmbedding; TextEmbedding(model_name='BAAI/bge-small-en-v1.5')"
COPY . .
# Hugging Face Spaces expects the app to listen on port 7860
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]