Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Install system deps | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Set Hugging Face cache to a writable directory | |
| ENV HF_HOME=/app/hf_cache | |
| # Copy requirements first | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Pre-cache Hugging Face models (avoid cold starts) | |
| RUN python -c "from transformers import Wav2Vec2Processor, AutoModelForAudioClassification; \ | |
| Wav2Vec2Processor.from_pretrained('facebook/wav2vec2-base-960h', cache_dir='/app/hf_cache'); \ | |
| AutoModelForAudioClassification.from_pretrained('prithivMLmods/Common-Voice-Gender-Detection', cache_dir='/app/hf_cache')" | |
| # Copy app | |
| COPY app.py . | |
| # Expose the port Hugging Face assigns (default 7860) | |
| EXPOSE 7860 | |
| # Run uvicorn, binding to $PORT injected by Hugging Face | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |