File size: 980 Bytes
211aa49
2f06631
211aa49
 
2f06631
211aa49
 
 
 
 
 
 
 
 
2f06631
211aa49
 
 
 
 
 
 
 
 
2f06631
211aa49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime

# Set working directory
WORKDIR /code

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

# Install Python dependencies
RUN pip install --no-cache-dir \
    fastapi==0.95.2 \
    uvicorn==0.22.0 \
    Pillow==9.5.0 \
    cairosvg==2.7.0 \
    numpy==1.24.3 \
    requests==2.31.0 \
    git+https://github.com/openai/CLIP.git

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

# Copy the model files
COPY . /code/

# Create a directory for model weights
RUN mkdir -p /code/model_weights

# Set environment variables
ENV MODEL_DIR=/code/model_weights
ENV PYTHONPATH=/code

# Expose the port
EXPOSE 8000

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