# CPU-only base that works well on Spaces FROM python:3.8.20 ENV DEBIAN_FRONTEND=noninteractive \ PIP_NO_CACHE_DIR=1 # System deps that MMDet often needs at runtime (and to import) RUN apt-get update && apt-get install -y --no-install-recommends \ git build-essential \ libgl1 libglib2.0-0 ffmpeg \ && rm -rf /var/lib/apt/lists/* # Python basics first RUN python -m pip install -U pip "setuptools<70" wheel # (Optional) Pin a stable Torch for CPU RUN python -m pip install "torch==2.3.*" "torchvision==0.18.*" --index-url https://download.pytorch.org/whl/cpu # Install OpenMIM and core OpenMMLab packages (CPU wheels) RUN python -m pip install -U openmim \ && mim install "mmengine>=0.10,<1.0" \ && mim install "mmcv>=2.0.0rc4,<2.2.0" \ && mim install "mmdet>=3.2.0,<4.0.0" RUN python -m pip install transformers>=4.35 ENV XDG_CACHE_HOME=/tmp/cache RUN mkdir -p /tmp/cache && chmod -R 777 /tmp/cache ENV MPLCONFIGDIR=/tmp/matplotlib RUN mkdir -p $XDG_CACHE_HOME/fontconfig \ && mkdir -p $MPLCONFIGDIR \ && chmod -R 777 /tmp ENV HF_HOME=/tmp/huggingface \ HUGGINGFACE_HUB_CACHE=/tmp/huggingface/hub \ TRANSFORMERS_CACHE=/tmp/huggingface/transformers RUN mkdir -p /tmp/huggingface/hub && mkdir -p /tmp/huggingface/transformers && chmod -R 777 /tmp/huggingface RUN python -m pip install gradio>=4.0.0 RUN python -m pip install supervision RUN python -m pip install timm # Your app WORKDIR /app #COPY app.py /app/ COPY . . EXPOSE 7860 ENV PORT=7860 # If your app needs extras: # RUN python -m pip install -U onnxruntime opencv-python-headless pillow tqdm CMD ["python", "app.py"]