File size: 970 Bytes
4039872
6a2700f
 
 
60b36a3
4039872
 
 
 
60b36a3
 
 
 
4039872
 
60b36a3
 
 
 
 
4039872
60b36a3
 
 
 
6a2700f
60b36a3
 
4039872
60b36a3
 
 
 
6a2700f
4039872
60b36a3
 
4039872
60b36a3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.9-slim

WORKDIR /app

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    python3-dev \
    libfreetype6-dev \
    pkg-config \
    libpng-dev \
    cmake \
    git \
    && rm -rf /var/lib/apt/lists/*

# Clone diffvg repository
RUN git clone https://github.com/BachiLi/diffvg.git && \
    cd diffvg && \
    git submodule update --init --recursive && \
    python setup.py install

# Install PyTorch and other dependencies
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install transformers pillow svgwrite svgpathtools numpy tqdm scikit-image matplotlib
RUN pip install fastapi uvicorn

# Copy model files
COPY . /app/model

# Copy handler files
COPY handler_template.py /app/
COPY diffsketcher_handler.py /app/
COPY api.py /app/

# Set environment variables
ENV MODEL_ID="jree423/diffsketcher"
ENV TASK="text-to-image"

# Run the API
CMD ["python", "api.py"]