Spaces:
Sleeping
Sleeping
File size: 992 Bytes
cf56062 cd3cf65 add6df8 f33deaf cd3cf65 fa08236 f33deaf cd3cf65 cf56062 cd3cf65 f33deaf add6df8 cf56062 f33deaf 038f843 f33deaf cd3cf65 cf56062 cd3cf65 f33deaf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
HF_HOME=/app/.cache/huggingface \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# Minimal OS deps
RUN apt-get update && apt-get install -y --no-install-recommends git git-lfs \
&& rm -rf /var/lib/apt/lists/* && git lfs install
# Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create writable dirs, warm caches, then hand ownership to runtime user (uid 1000)
RUN mkdir -p /app/.cache/huggingface /app/data \
&& python - <<'PY'
from transformers import BlipProcessor, BlipForConditionalGeneration
BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
print("BLIP ready")
PY
# HF Spaces runs the container as uid 1000; give it the whole /app tree
RUN chown -R 1000:1000 /app
# App code
COPY . .
EXPOSE 7860
CMD ["uvicorn","app:app","--host","0.0.0.0","--port","7860"]
|