lid / Dockerfile
Hammad712's picture
Update Dockerfile
e5de087 verified
raw
history blame contribute delete
997 Bytes
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# System dependencies
RUN apt-get update && apt-get install -y libsndfile1 ffmpeg && rm -rf /var/lib/apt/lists/*
# Install Python requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all files first
COPY . .
# Now Download Model into the absolute path /app/local_model
RUN python3 -c "from huggingface_hub import hf_hub_download; \
hf_hub_download(repo_id='Hammad712/pakistani-lid-v3-sota', filename='pakistani_lid_v3.onnx.data', local_dir='/app/local_model', local_dir_use_symlinks=False); \
hf_hub_download(repo_id='Hammad712/pakistani-lid-v3-sota', filename='pakistani_lid_v3.onnx', local_dir='/app/local_model', local_dir_use_symlinks=False)"
EXPOSE 7860
# 🚨 CRITICAL: Only 1 worker for RAM stability!
CMD ["gunicorn", "app:app", "--workers", "1", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--timeout", "300"]