Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +12 -4
Dockerfile
CHANGED
@@ -1,9 +1,17 @@
|
|
1 |
-
# Minimal Dockerfile for Hugging Face Spaces or local deployment
|
2 |
FROM python:3.10-slim
|
3 |
WORKDIR /code
|
4 |
-
RUN pip install transformers torch
|
5 |
-
RUN python -c "from transformers import BlipProcessor, BlipForConditionalGeneration; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base'); BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')"
|
6 |
COPY . .
|
|
|
|
|
7 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
EXPOSE 7860
|
9 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
WORKDIR /code
|
|
|
|
|
3 |
COPY . .
|
4 |
+
|
5 |
+
# Install all dependencies (including pillow)
|
6 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
7 |
+
|
8 |
+
# Set cache dir env vars (fixes Hugging Face Space permissions)
|
9 |
+
ENV HF_HOME="/data"
|
10 |
+
ENV TRANSFORMERS_CACHE="/data"
|
11 |
+
RUN mkdir -p /data
|
12 |
+
|
13 |
+
# (Optional, but speeds up runtime) Pre-download BLIP model weights
|
14 |
+
RUN python -c "from transformers import BlipProcessor, BlipForConditionalGeneration; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base'); BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')"
|
15 |
+
|
16 |
EXPOSE 7860
|
17 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|