FROM python:3.11-slim WORKDIR /app # Ensure Python output is unbuffered (logs visible in HF Spaces) ENV PYTHONUNBUFFERED=1 # Install system dependencies (ffmpeg REQUIRED for audio conversion!) RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Force rebuild: v2 (change this comment to invalidate Docker cache) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Pre-download Whisper model during build (faster startup) RUN python -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-small')" # Pre-download Silero TTS model during build (into /app where runtime CWD is) RUN python -c "import torch; torch.hub.download_url_to_file('https://models.silero.ai/models/tts/ru/v4_ru.pt', '/app/v4_ru.pt')" # Copy application code COPY ./app /app/app # HuggingFace Spaces uses port 7860 EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]