Spaces:
Sleeping
Sleeping
File size: 1,195 Bytes
4ea7f74 bf6e45c 4ea7f74 bf6e45c 4ea7f74 bf6e45c 4ea7f74 44bb229 | 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 | FROM python:3.11-slim
WORKDIR /app
# System deps: build-essential (pdf extraction), espeak-ng (Kokoro/misaki g2p
# fallback for out-of-dictionary words), curl (TTS model download below)
RUN apt-get update && apt-get install -y \
build-essential \
curl \
espeak-ng \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Kokoro ONNX model files — the fp32 export (same weights as the torch release,
# so audio quality is unchanged; do NOT swap in the int8/fp16 variants unless a
# quality drop is acceptable). ~340MB total; skip with
# --build-arg DOWNLOAD_TTS_MODELS=false (TTS then 503s and clients fall back).
ARG DOWNLOAD_TTS_MODELS=true
RUN if [ "$DOWNLOAD_TTS_MODELS" = "true" ]; then \
mkdir -p models && \
curl -fL -o models/kokoro-v1.0.onnx \
https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx && \
curl -fL -o models/voices-v1.0.bin \
https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin ; \
fi
COPY . .
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|