Samfredoly commited on
Commit
976fe0f
·
verified ·
1 Parent(s): add2ebd

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ git \
6
+ wget \
7
+ libgl1-mesa-glx \
8
+ libglib2.0-0 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Set working directory
12
+ WORKDIR /app
13
+
14
+ # Copy the GroundingDINO code
15
+ RUN git clone https://github.com/IDEA-Research/GroundingDINO.git .
16
+
17
+ # Install dependencies and the package
18
+ RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
19
+ RUN pip install transformers==4.35.2
20
+ RUN pip install fastapi uvicorn python-multipart supervision opencv-python-headless huggingface_hub
21
+ RUN pip install -e .
22
+
23
+ # Create weights directory and download Swin-B weights
24
+ RUN mkdir -p weights && \
25
+ wget -O weights/groundingdino_swinb_cogcoor.pth https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha2/groundingdino_swinb_cogcoor.pth && \
26
+ cp groundingdino/config/GroundingDINO_SwinB_cfg.py weights/GroundingDINO_SwinB_cfg.py
27
+
28
+ # Copy the application code
29
+ COPY main.py .
30
+
31
+ # Expose port 7860 (Hugging Face Spaces default)
32
+ EXPOSE 7860
33
+
34
+ # Run the application
35
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]