Spaces:
Running
Running
Fix libxcb ImportError: Add GUI Linux dependencies for OpenCV into explicit Dockerfile layer
ae18450 | FROM python:3.10-slim | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 libsm6 libxext6 libxrender-dev libxcb1 libxcb-shape0 libxcb-xfixes0 && rm -rf /var/lib/apt/lists/* | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install "numpy<2" | |
| # Download model locally during build to avoid downtime on first request | |
| RUN python -c "from transformers import BlipProcessor; BlipProcessor.from_pretrained('Salesforce/blip-image-captioning-base')" || true | |
| COPY . . | |
| # Expose port that HuggingFace Spaces/Render uses | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |