Spaces:
Sleeping
Sleeping
File size: 1,741 Bytes
dcf73a3 6373f05 dcf73a3 6373f05 dcf73a3 6373f05 dcf73a3 6373f05 dcf73a3 6373f05 dcf73a3 6373f05 dcf73a3 | 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 | # OmniVoice TTS — HuggingFace Space (Docker SDK), T4 / dedicated GPU.
#
# Base: python:3.11-slim. We install torch 2.8.0 + cu128 ourselves to match
# the upstream k2-fsa/OmniVoice Space exactly. Using a generic Python base
# lets us upgrade torch without fighting a frozen CUDA layer and means the
# image works on either CPU or GPU hardware (torch's cu128 wheels statically
# link CUDA at runtime when a driver is present).
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
HF_HOME=/data/.cache/huggingface \
HF_HUB_ENABLE_HF_TRANSFER=1 \
TORCH_HOME=/data/.cache/torch \
PORT=7860
# System deps for soundfile/librosa + audio + curl for HEALTHCHECK
RUN apt-get update && apt-get install -y --no-install-recommends \
libsndfile1 ffmpeg git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install torch first so other deps don't pull a different cuda variant.
# Versions match upstream k2-fsa/OmniVoice's requirements.txt.
RUN pip install --upgrade pip && \
pip install torch==2.8.0 torchaudio==2.8.0 \
--extra-index-url https://download.pytorch.org/whl/cu128
COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
COPY app.py /app/app.py
# HF Spaces map persistent state into /data; pre-create cache dirs so the model
# download lands in a writeable spot regardless of the runtime's UID.
RUN mkdir -p /data/.cache/huggingface /data/.cache/torch && chmod -R 777 /data
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --retries=5 \
CMD curl -fsS http://localhost:7860/health || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
|