Spaces:
Sleeping
Sleeping
| # ββ Build stage βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System libraries required by OpenCV + PaddlePaddle + transformers | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libglib2.0-0 \ | |
| libgl1 \ | |
| libgomp1 \ | |
| libgcc-s1 \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Install CPU-only PyTorch first (avoids pulling 2 GB CUDA wheels) ββββββββββ | |
| RUN pip install --no-cache-dir \ | |
| torch==2.3.0 \ | |
| torchvision==0.18.0 \ | |
| --index-url https://download.pytorch.org/whl/cpu | |
| # ββ Install remaining Python dependencies βββββββββββββββββββββββββββββββββββββ | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # ββ Copy source code and models into the container ββββββββββββββββββββββββββββ | |
| COPY . . | |
| # Tell PaddleOCR 3.x (paddlex backend) where to find offline model weights | |
| ENV PADDLE_PDX_MODEL_HOME=/app/models/paddleocr | |
| # HuggingFace Spaces must expose port 7860 | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |