t29mato commited on
Commit
fb7addb
·
1 Parent(s): ce63dd6

Switch to Docker SDK for reliable mmcv-full build

Browse files

Gradio SDK pip install fails with mmcv-full. Docker gives full
control over build order: torch first, then mmcv-full pre-built
wheel, then remaining deps.

Files changed (2) hide show
  1. Dockerfile +43 -0
  2. README.md +1 -3
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # System dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ libgl1-mesa-glx \
6
+ libglib2.0-0 \
7
+ gcc \
8
+ g++ \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ WORKDIR /app
12
+
13
+ # Install PyTorch CPU first
14
+ RUN pip install --no-cache-dir \
15
+ torch==1.13.1+cpu \
16
+ torchvision==0.14.1+cpu \
17
+ -f https://download.pytorch.org/whl/cpu/torch_stable.html
18
+
19
+ # Install mmcv-full pre-built wheel
20
+ RUN pip install --no-cache-dir \
21
+ mmcv-full==1.7.2 \
22
+ -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.13.0/index.html
23
+
24
+ # Install remaining dependencies
25
+ RUN pip install --no-cache-dir \
26
+ gradio>=5.0.0 \
27
+ opencv-python-headless>=4.8.0 \
28
+ "numpy>=1.24.0,<2.0.0" \
29
+ easyocr>=1.7.0 \
30
+ scikit-image>=0.21.0 \
31
+ scipy>=1.9.0 \
32
+ bresenham \
33
+ terminaltables \
34
+ matplotlib \
35
+ pycocotools
36
+
37
+ # Copy application code
38
+ COPY . .
39
+
40
+ # HF Spaces expects port 7860
41
+ EXPOSE 7860
42
+
43
+ CMD ["python", "api_server.py"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: AutoLineDigitizer API
3
  emoji: 📈
4
  colorFrom: blue
5
  colorTo: green
6
- sdk: gradio
7
- sdk_version: 5.20.1
8
- app_file: api_server.py
9
  pinned: false
10
  license: mit
11
  ---
 
3
  emoji: 📈
4
  colorFrom: blue
5
  colorTo: green
6
+ sdk: docker
 
 
7
  pinned: false
8
  license: mit
9
  ---