Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +24 -18
Dockerfile
CHANGED
|
@@ -2,33 +2,39 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install
|
| 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 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
# Install
|
| 20 |
-
RUN pip install --
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
|
| 25 |
-
# Copy
|
| 26 |
-
COPY .
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Set environment variables
|
| 29 |
-
ENV
|
| 30 |
-
ENV
|
| 31 |
-
ENV PYTHONPATH=/app
|
| 32 |
|
| 33 |
-
# Run the API
|
| 34 |
-
CMD ["python", "
|
|
|
|
| 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"]
|