Spaces:
Running
Running
| FROM python:3.10-slim | |
| # System deps: | |
| # ffmpeg β Whisper audio processing | |
| # libsndfile1 β soundfile (MMS TTS WAV I/O) | |
| # git β pip install from GitHub (OpenVoice v2) | |
| # build-essential β some torch/audio wheels need gcc | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| espeak-ng \ | |
| libsndfile1 \ | |
| git \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install Python deps first (layer-caches before code copy) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel \ | |
| && pip install --no-cache-dir \ | |
| torch==2.2.2+cpu \ | |
| --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --no-cache-dir -r requirements.txt \ | |
| && pip install --no-cache-dir --no-deps \ | |
| git+https://github.com/myshell-ai/OpenVoice.git | |
| # Copy app code + model checkpoints | |
| COPY . . | |
| # HuggingFace model cache lives here β keeps re-downloads fast across builds | |
| ENV HF_HOME=/app/.cache/huggingface | |
| # HuggingFace Spaces Docker requires port 7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |