Spaces:
Sleeping
Sleeping
File size: 920 Bytes
f973701 9772c3c e239952 f973701 9772c3c 6ca35e1 3d540f1 6ca35e1 78c0a02 e239952 9772c3c e239952 02bd2b2 6ca35e1 792af26 78c0a02 6ca35e1 e239952 6ca35e1 78c0a02 43a582e | 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 33 34 | FROM python:3.10-slim
# Install system dependencies for OpenCV
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
libgl1 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/*
WORKDIR /app
# Copy and install requirements
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir --default-timeout=1000 -r requirements.txt
# Copy model files (changes less frequently)
COPY trainedmodels/ ./trainedmodels/
# Copy application code (changes most frequently)
COPY app.py inference.py ./
# Environment optimizations
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
EXPOSE 7860
# Optimized for HuggingFace Spaces
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info", "--timeout-keep-alive", "75"]
|