jree423 commited on
Commit
7dfc3bb
·
verified ·
1 Parent(s): 5d01a0f

Fix: Update Dockerfile and requirements.txt to include cairosvg dependency

Browse files
Files changed (2) hide show
  1. Dockerfile +13 -27
  2. requirements.txt +18 -34
Dockerfile CHANGED
@@ -1,40 +1,26 @@
1
- FROM python:3.9-slim
2
 
3
- WORKDIR /app
4
 
5
- # Install dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  python3-dev \
9
  libfreetype6-dev \
10
  pkg-config \
11
  libpng-dev \
 
 
12
  cmake \
13
- git \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Clone diffvg repository
17
- RUN git clone https://github.com/BachiLi/diffvg.git && \
18
- cd diffvg && \
19
- git submodule update --init --recursive && \
20
- python setup.py install
21
 
22
- # Install PyTorch and other dependencies
23
- RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
24
- RUN pip install transformers pillow svgwrite svgpathtools numpy tqdm scikit-image matplotlib
25
- RUN pip install fastapi uvicorn
26
 
27
- # Copy model files
28
- COPY . /app/model
29
-
30
- # Copy handler files
31
- COPY handler_template.py /app/
32
- COPY diffsketcher_handler.py /app/
33
- COPY api.py /app/
34
-
35
- # Set environment variables
36
- ENV MODEL_ID="jree423/diffsketcher"
37
- ENV TASK="text-to-image"
38
-
39
- # Run the API
40
- CMD ["python", "api.py"]
 
1
+ FROM python:3.10
2
 
3
+ WORKDIR /code
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  python3-dev \
9
  libfreetype6-dev \
10
  pkg-config \
11
  libpng-dev \
12
+ libcairo2-dev \
13
+ libffi-dev \
14
  cmake \
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Install Python dependencies
18
+ COPY requirements.txt .
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
+ RUN pip install --no-cache-dir cairosvg diffvg
 
21
 
22
+ # Copy application code
23
+ COPY . .
 
 
24
 
25
+ # Set up the API
26
+ CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,34 +1,18 @@
1
- torch>=1.8.0,<2.0.0
2
- torchvision<0.16.0
3
- diffusers==0.20.2
4
- transformers<4.30.0
5
- accelerate
6
- hydra-core
7
- omegaconf
8
- freetype-py
9
- shapely
10
- svgutils
11
- opencv-python
12
- scikit-image
13
- matplotlib
14
- wandb
15
- beautifulsoup4
16
- numba
17
- scipy
18
- einops
19
- timm<0.9.0
20
- fairscale==0.4.13
21
- safetensors
22
- datasets
23
- easydict
24
- scikit-learn
25
- pytorch_lightning==2.1.0
26
- webdataset
27
- ftfy
28
- regex
29
- tqdm
30
- svgwrite
31
- svgpathtools
32
- cssutils
33
- cairosvg
34
- pillow<10.0.0
 
1
+ torch>=2.0.0
2
+ torchvision>=0.15.1
3
+ diffusers>=0.15.1
4
+ transformers>=4.27.4
5
+ accelerate>=0.18.0
6
+ huggingface_hub>=0.14.1
7
+ pillow>=9.5.0
8
+ numpy>=1.24.3
9
+ tqdm>=4.65.0
10
+ fastapi>=0.95.1
11
+ uvicorn>=0.22.0
12
+ python-multipart>=0.0.6
13
+ cairosvg>=2.7.0
14
+ svgwrite>=1.4.3
15
+ svgpathtools>=1.6.0
16
+ opencv-python>=4.7.0.72
17
+ scikit-image>=0.20.0
18
+ matplotlib>=3.7.1