Manus AI
Fix: Replace obsolete libgl1-mesa-glx with libgl1 and libglx-mesa0 in Dockerfile
9d5d881
FROM python:3.11-slim
# Install system dependencies
# libgl1-mesa-glx is obsolete in newer Debian (Trixie), replaced by libgl1 and libglx-mesa0
RUN apt-get update && apt-get install -y \
git \
wget \
libgl1 \
libglx-mesa0 \
libglib2.0-0 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy the GroundingDINO code first
RUN git clone https://github.com/IDEA-Research/GroundingDINO.git .
# Install dependencies and the package
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir transformers==4.35.2
RUN pip install --no-cache-dir fastapi uvicorn python-multipart supervision opencv-python-headless huggingface_hub
# Install GroundingDINO package without CUDA extensions for CPU mode
ENV CUDA_HOME=""
RUN pip install --no-cache-dir -e .
# Create weights directory and download Swin-B weights
RUN mkdir -p weights && \
wget -q -O weights/groundingdino_swinb_cogcoor.pth https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha2/groundingdino_swinb_cogcoor.pth && \
cp groundingdino/config/GroundingDINO_SwinB_cfg.py weights/GroundingDINO_SwinB_cfg.py
# Copy the application code
COPY main.py .
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]