Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -2
Dockerfile
CHANGED
|
@@ -3,7 +3,12 @@ WORKDIR /code
|
|
| 3 |
COPY . .
|
| 4 |
|
| 5 |
# Install C++ build tools first
|
| 6 |
-
RUN apt-get update && apt-get install -y build-essential && apt-get clean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Install all dependencies (including pillow)
|
| 9 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
@@ -14,7 +19,14 @@ ENV TRANSFORMERS_CACHE="/data"
|
|
| 14 |
RUN mkdir -p /data
|
| 15 |
|
| 16 |
# (Optional, but speeds up runtime) Pre-download BLIP model weights
|
| 17 |
-
RUN python -c "from transformers import BlipProcessor, BlipForConditionalGeneration; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base'); BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
EXPOSE 7860
|
| 20 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 3 |
COPY . .
|
| 4 |
|
| 5 |
# Install C++ build tools first
|
| 6 |
+
# RUN apt-get update && apt-get install -y build-essential && apt-get clean
|
| 7 |
+
|
| 8 |
+
RUN apt-get update && \
|
| 9 |
+
apt-get install -y build-essential libgl1-mesa-glx libglib2.0-0 && \
|
| 10 |
+
apt-get clean
|
| 11 |
+
|
| 12 |
|
| 13 |
# Install all dependencies (including pillow)
|
| 14 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
|
|
| 19 |
RUN mkdir -p /data
|
| 20 |
|
| 21 |
# (Optional, but speeds up runtime) Pre-download BLIP model weights
|
| 22 |
+
# RUN python -c "from transformers import BlipProcessor, BlipForConditionalGeneration; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base'); BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')"
|
| 23 |
+
|
| 24 |
+
# Pre-download DeepFace models
|
| 25 |
+
RUN python -c "from deepface import DeepFace; DeepFace.analyze('https://raw.githubusercontent.com/serengil/deepface/master/tests/dataset/img1.jpg', actions=['age', 'gender', 'race', 'emotion'], enforce_detection=False)"
|
| 26 |
+
# Pre-download InsightFace models
|
| 27 |
+
RUN python -c \"import insightface; import numpy as np; app = insightface.app.FaceAnalysis(name='buffalo_l', providers=['CPUExecutionProvider']); app.prepare(ctx_id=0); img = np.zeros((640, 640, 3), dtype=np.uint8); app.get(img)\"
|
| 28 |
+
|
| 29 |
+
|
| 30 |
|
| 31 |
EXPOSE 7860
|
| 32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|