Spaces:
Sleeping
Sleeping
File size: 953 Bytes
4438597 acc7904 8479bfb 4438597 8479bfb 46fd547 acc7904 46fd547 8479bfb 4438597 acc7904 0e69ee0 8479bfb 5f8e73c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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"]
|