jree423 commited on
Commit
b6dea93
·
verified ·
1 Parent(s): a088a79

Add: diffsketcher Dockerfile with original implementation

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -8
Dockerfile CHANGED
@@ -9,22 +9,35 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  libcairo2-dev \
11
  pkg-config \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
14
  # Install PyTorch and torchvision
15
  RUN pip install torch==2.0.0 torchvision==0.15.1 --extra-index-url https://download.pytorch.org/whl/cpu
16
 
17
- # Install cairosvg and other dependencies
18
- RUN pip install cairosvg cairocffi cssselect2 defusedxml tinycss2
 
 
 
 
 
 
 
19
 
20
- # Install FastAPI and other dependencies
21
- RUN pip install fastapi uvicorn pydantic pillow numpy requests
22
 
23
- # Copy the model files
24
- COPY . /code/
 
25
 
26
  # Set environment variables
27
- ENV PYTHONUNBUFFERED=1
 
28
 
29
  # Run the API server
30
- CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
 
9
  git \
10
  libcairo2-dev \
11
  pkg-config \
12
+ wget \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Clone the repository
16
+ RUN git clone https://github.com/ximinng/DiffSketcher.git /code/diffsketcher
17
+
18
  # Install PyTorch and torchvision
19
  RUN pip install torch==2.0.0 torchvision==0.15.1 --extra-index-url https://download.pytorch.org/whl/cpu
20
 
21
+ # Install dependencies
22
+ WORKDIR /code/diffsketcher
23
+ RUN pip install -r requirements.txt
24
+
25
+ # Install diffvg
26
+ RUN git clone https://github.com/BachiLi/diffvg.git /code/diffvg && \
27
+ cd /code/diffvg && \
28
+ git submodule update --init --recursive && \
29
+ python setup.py install
30
 
31
+ # Install additional dependencies
32
+ RUN pip install cairosvg cairocffi cssselect2 defusedxml tinycss2 fastapi uvicorn pydantic
33
 
34
+ # Copy the handler and API
35
+ COPY handler.py /code/
36
+ COPY api.py /code/
37
 
38
  # Set environment variables
39
+ ENV PYTHONPATH=/code:/code/diffsketcher:/code/diffvg
40
+ ENV MODEL_DIR=/code/diffsketcher
41
 
42
  # Run the API server
43
+ CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]