Spaces:
Running
Running
File size: 920 Bytes
fe47fa8 e5f3fc8 fe47fa8 513862a fe47fa8 e5f3fc8 fe47fa8 e5f3fc8 fe47fa8 cc87b5c fe47fa8 20083da fe47fa8 e5f3fc8 fe47fa8 e5f3fc8 fe47fa8 | 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
WORKDIR /app
# System dependencies for OpenCV
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
git \
&& rm -rf /var/lib/apt/lists/*
# Clone the MiVOLO repository
RUN git clone https://github.com/WildChlamydia/MiVOLO.git /app/mivolo_repo
# Install PyTorch CPU-only (much lighter than full GPU build)
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install remaining API dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy our API entrypoint and the uploaded checkpoint file
COPY app.py .
COPY *.pth.tar ./
# Hugging Face Spaces use port 7860
EXPOSE 7860
# NOTE: We do NOT pre-load models here to avoid OOM during build.
# Models download on the first API request at runtime (16GB RAM available).
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|