Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +42 -6
Dockerfile
CHANGED
@@ -1,10 +1,46 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime
|
2 |
|
3 |
+
# Set working directory
|
4 |
+
WORKDIR /code
|
5 |
|
6 |
+
# Install system dependencies
|
7 |
+
RUN apt-get update && apt-get install -y \
|
8 |
+
build-essential \
|
9 |
+
python3-dev \
|
10 |
+
git \
|
11 |
+
cmake \
|
12 |
+
libcairo2-dev \
|
13 |
+
pkg-config \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
+
# Install Python dependencies
|
17 |
+
RUN pip install --no-cache-dir \
|
18 |
+
fastapi==0.95.2 \
|
19 |
+
uvicorn==0.22.0 \
|
20 |
+
Pillow==9.5.0 \
|
21 |
+
cairosvg==2.7.0 \
|
22 |
+
numpy==1.24.3 \
|
23 |
+
requests==2.31.0 \
|
24 |
+
git+https://github.com/openai/CLIP.git
|
25 |
|
26 |
+
# Install diffvg
|
27 |
+
RUN git clone https://github.com/BachiLi/diffvg.git && \
|
28 |
+
cd diffvg && \
|
29 |
+
git submodule update --init --recursive && \
|
30 |
+
python setup.py install
|
31 |
+
|
32 |
+
# Copy the model files
|
33 |
+
COPY . /code/
|
34 |
+
|
35 |
+
# Create a directory for model weights
|
36 |
+
RUN mkdir -p /code/model_weights
|
37 |
+
|
38 |
+
# Set environment variables
|
39 |
+
ENV MODEL_DIR=/code/model_weights
|
40 |
+
ENV PYTHONPATH=/code
|
41 |
+
|
42 |
+
# Expose the port
|
43 |
+
EXPOSE 8000
|
44 |
+
|
45 |
+
# Start the API server
|
46 |
+
CMD ["python", "api.py"]
|