Spaces:
Running
Running
| # AmaniQuery VibeVoice - Hugging Face Spaces Dockerfile | |
| # Dedicated TTS service using Microsoft VibeVoice model | |
| FROM python:3.11-slim AS base | |
| ARG CACHEBUST=2025-12-16 | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONPATH=/app \ | |
| PORT=7860 \ | |
| HF_HOME=/app/models | |
| # Install system dependencies for audio processing | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| curl \ | |
| build-essential \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy requirements for VibeVoice | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Pre-download VibeVoice model | |
| RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('microsoft/VibeVoice-Realtime-0.5B')" | |
| # Copy VibeVoice library and app | |
| COPY vibevoice/ ./vibevoice/ | |
| COPY app.py ./ | |
| # Create necessary directories | |
| RUN mkdir -p /app/models /app/cache && \ | |
| useradd --create-home --shell /bin/bash app && \ | |
| chown -R app:app /app | |
| USER app | |
| EXPOSE ${PORT} | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 \ | |
| CMD curl -f http://localhost:${PORT}/health || exit 1 | |
| # Default voice configuration | |
| ENV VIBEVOICE_DEVICE=cpu \ | |
| VIBEVOICE_VOICE=Wayne \ | |
| VIBEVOICE_CFG_SCALE=1.5 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |