Files
surya-ocr/surya/recognition/schema.py
T
Fu DaiandClaude Opus 4.8 1a585693be Suya OCR API — vLLM-backed, OpenAI-compatible OCR service
FastAPI service wrapping the Surya-OCR-2 model (datalab-to) served through vLLM:
legacy /v1/api/ai/* endpoints, an OpenAI-compatible /v1/chat/completions endpoint,
a coalescing request batcher, a local OCR CLI, Docker packaging, multilingual
example outputs, and quantization/concurrency benchmarks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 10:20:02 +04:00

20 lines
568 B
Python

from typing import List
from pydantic import BaseModel
from surya.common.polygon import PolygonBox
class BlockOCRResult(PolygonBox):
label: str # canonicalized layout label (Picture, Text, ...)
raw_label: str = "" # original model label
reading_order: int # 0-indexed position in layout output
html: str = "" # block HTML (BLOCK_PROMPT output, "" if skipped)
skipped: bool = False # True if label was in SKIP_OCR_LABELS
error: bool = False
class PageOCRResult(BaseModel):
blocks: List[BlockOCRResult]
image_bbox: List[float]