Spaces:
Sleeping
Sleeping
File size: 849 Bytes
e04bbc2 | 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 | FROM python:3.11-slim
# OpenCV runtime deps
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 libgl1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir ultralytics
COPY analysis ./analysis
COPY models ./models
COPY app.py .
# PRELOAD_NN: import torch and load the weights during startup instead of on
# someone's first click. The Space is long-lived, so it pays this once.
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 PRELOAD_NN=1
# HF Spaces routes traffic to port 7860 by convention
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|