Spaces:
Paused
Paused
| FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV HF_HOME=/app/model_cache | |
| ENV TORCH_HOME=/app/torch_cache | |
| # Install Python 3.12 + system deps | |
| RUN apt-get update && apt-get install -y \ | |
| software-properties-common \ | |
| git \ | |
| curl \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| && add-apt-repository ppa:deadsnakes/ppa \ | |
| && apt-get update \ | |
| && apt-get install -y python3.12 python3.12-venv python3.12-dev \ | |
| && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 \ | |
| && ln -sf /usr/bin/python3.12 /usr/bin/python \ | |
| && ln -sf /usr/bin/python3.12 /usr/bin/python3 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Remove conflicting system packages | |
| RUN apt-get update && apt-get remove -y python3-blinker || true \ | |
| && rm -rf /usr/lib/python3/dist-packages/blinker* \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt /app/requirements.txt | |
| WORKDIR /app | |
| RUN pip install --no-cache-dir --break-system-packages -r requirements.txt | |
| # Install flash-attn for faster inference (optional, build may fail on some GPUs) | |
| RUN MAX_JOBS=4 pip install flash-attn --no-build-isolation \ | |
| || echo "flash-attn install failed, continuing without it" | |
| # Pre-download ASR model into the image (no persistent storage available on HF Spaces) | |
| RUN mkdir -p /app/model_cache /app/torch_cache && \ | |
| python -c "\ | |
| from huggingface_hub import snapshot_download; \ | |
| snapshot_download('Qwen/Qwen3-ASR-1.7B', cache_dir='/app/model_cache')" \ | |
| && echo "ASR model pre-downloaded" | |
| # Pre-download Silero VAD model | |
| RUN python -c "\ | |
| import torch; \ | |
| torch.hub.load('snakers4/silero-vad', 'silero_vad', trust_repo=True); \ | |
| print('Silero VAD cached')" || echo "VAD pre-download failed, will retry at runtime" | |
| # Copy application code | |
| COPY . /app | |
| EXPOSE 7860 | |
| # Health check — long start period for model download + load | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=600s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| CMD ["python", "app.py"] | |
| # Rebuild trigger: Wed Apr 22 18:13:56 PKT 2026 | |