jree423 commited on
Commit
60b36a3
·
verified ·
1 Parent(s): 79a607b

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -18
Dockerfile CHANGED
@@ -2,33 +2,39 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
- cmake \
9
- git \
10
- libcairo2-dev \
11
- pkg-config \
12
  python3-dev \
13
  libfreetype6-dev \
 
 
 
 
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Copy requirements first to leverage Docker cache
17
- COPY requirements.txt .
 
 
 
18
 
19
- # Install Python dependencies
20
- RUN pip install --no-cache-dir -r requirements.txt
 
 
21
 
22
- # Install diffvg from the DiffSketcher project
23
- RUN pip install --no-cache-dir git+https://github.com/ximinng/DiffSketcher-project.git#subdirectory=diffvg
24
 
25
- # Copy the model files
26
- COPY . .
 
 
27
 
28
  # Set environment variables
29
- ENV PYTHONUNBUFFERED=1
30
- ENV PYTHONDONTWRITEBYTECODE=1
31
- ENV PYTHONPATH=/app
32
 
33
- # Run the API server
34
- CMD ["python", "app.py"]
 
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"]