Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +30 -10
Dockerfile
CHANGED
|
@@ -1,16 +1,36 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /opt/NekoImageGallery
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
ARG TORCH_VERSION=2.3.0
|
| 2 |
+
ARG CUDA_VERSION=12.1
|
| 3 |
+
FROM pytorch/pytorch:${TORCH_VERSION}-cuda${CUDA_VERSION}-cudnn8-runtime
|
| 4 |
|
|
|
|
| 5 |
WORKDIR /opt/NekoImageGallery
|
| 6 |
|
| 7 |
+
COPY requirements.txt .
|
| 8 |
+
|
| 9 |
+
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.txt
|
| 10 |
+
|
| 11 |
+
RUN mkdir -p /opt/models && \
|
| 12 |
+
export PYTHONDONTWRITEBYTECODE=1 && \
|
| 13 |
+
huggingface-cli download openai/clip-vit-large-patch14 'model.safetensors' '*.txt' '*.json' --local-dir /opt/models/clip && \
|
| 14 |
+
huggingface-cli download google-bert/bert-base-chinese 'model.safetensors' '*.txt' '*.json' --local-dir /opt/models/bert && \
|
| 15 |
+
huggingface-cli download pk5ls20/PaddleModel 'PaddleOCR2Pytorch/ch_ptocr_v4_det_infer.pth' 'PaddleOCR2Pytorch/ch_ptocr_v4_rec_infer.pth' \
|
| 16 |
+
'PaddleOCR2Pytorch/ch_ptocr_mobile_v2.0_cls_infer.pth' 'PaddleOCR2Pytorch/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml' \
|
| 17 |
+
'PaddleOCR2Pytorch/configs/rec/PP-OCRv4/ch_PP-OCRv4_rec.yml' 'ppocr_keys_v1.txt' --local-dir /opt/models/ocr && \
|
| 18 |
+
rm -rf /root/.cache/huggingface
|
| 19 |
+
|
| 20 |
+
ENV APP_MODEL__CLIP=/opt/models/clip
|
| 21 |
+
ENV APP_MODEL__BERT=/opt/models/bert
|
| 22 |
+
ENV APP_MODEL__EASYPADDLEOCR=/opt/models/ocr
|
| 23 |
|
| 24 |
+
COPY . .
|
| 25 |
+
|
| 26 |
+
EXPOSE 8000
|
| 27 |
+
|
| 28 |
+
VOLUME ["/opt/NekoImageGallery/static"]
|
| 29 |
|
| 30 |
+
LABEL org.opencontainers.image.authors="EdgeNeko" \
|
| 31 |
+
org.opencontainers.image.url="https://github.com/hv0905/NekoImageGallery" \
|
| 32 |
+
org.opencontainers.image.source="https://github.com/hv0905/NekoImageGallery" \
|
| 33 |
+
org.opencontainers.image.title="NekoImageGallery" \
|
| 34 |
+
org.opencontainers.image.description="An AI-powered natural language & reverse Image Search Engine powered by CLIP & qdrant."
|
| 35 |
|
| 36 |
+
ENTRYPOINT ["python", "main.py"]
|
|
|