gitre / Dockerfile
d3evil4's picture
feat: switch default model to Kokoro-82M and add voice normalization
a069204
Raw
History Blame Contribute Delete
1.16 kB
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860 \
MODEL_ID=hexgrad/Kokoro-82M \
DEFAULT_VOICE=af_heart \
HF_HOME=/app/.cache/huggingface \
TRANSFORMERS_CACHE=/app/.cache/huggingface
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libsndfile1 \
ffmpeg \
espeak-ng \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt
COPY . .
RUN mkdir -p /app/.cache/huggingface \
&& python - <<'PY'
import os
from huggingface_hub import snapshot_download
repo = os.environ['MODEL_ID']
cache_dir = '/app/.cache/huggingface'
path = snapshot_download(
repo_id=repo,
repo_type='model',
cache_dir=cache_dir,
allow_patterns=['*.json', '*.txt', '*.pt', '*.bin', '*.safetensors', 'tokenizer*', 'voices/*'],
local_dir_use_symlinks=False,
)
print(path)
PY
EXPOSE 7860
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"]