| from typing import List, Tuple | |
| from pydantic import BaseModel, Field | |
| # Axis-aligned bounding box: (x1, y1, x2, y2) | |
| BBox = Tuple[int, int, int, int] | |
| class OCRBlock(BaseModel): | |
| """A single OCR detection result.""" | |
| page: int = Field(ge=1, description="1-based page index") | |
| bbox: BBox | |
| text: str | |
| confidence: float | |
| class OCRDocument(BaseModel): | |
| """A collection of OCR blocks (multi-page friendly).""" | |
| blocks: List[OCRBlock] |