Spaces:
Running
Running
FROM python:3.10-slim | |
WORKDIR /code | |
COPY . . | |
# Install all dependencies (including pillow) | |
RUN pip install --upgrade pip && pip install -r requirements.txt | |
# Set cache dir env vars (fixes Hugging Face Space permissions) | |
ENV HF_HOME="/data" | |
ENV TRANSFORMERS_CACHE="/data" | |
RUN mkdir -p /data | |
# (Optional, but speeds up runtime) Pre-download BLIP model weights | |
RUN python -c "from transformers import BlipProcessor, BlipForConditionalGeneration; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base'); BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-base')" | |
EXPOSE 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |