Files
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

45 lines
1.3 KiB
Python

"""Surya2 layout labels emitted by the model + canonicalization to surya's
public label vocabulary."""
# Canonical text-bearing labels — used by blank-region filters to decide
# which blocks may be dropped when their underlying image region is empty.
# Excludes Picture/Figure/Diagram/Table/Form/Equation/etc., which can legitimately
# contain whitespace or solid fills.
TEXT_LABELS = frozenset(
{
"Text",
"SectionHeader",
"PageHeader",
"PageFooter",
"Caption",
"Footnote",
"Code",
"Bibliography",
}
)
# Canonicalize raw model labels to public surya label names. Marker and other
# downstream consumers depend on these names.
LAYOUT_PRED_RELABEL = {
"Caption": "Caption",
"Footnote": "Footnote",
"Equation-Block": "Equation",
"List-Group": "ListGroup",
"Page-Header": "PageHeader",
"Page-Footer": "PageFooter",
"Image": "Picture",
"Section-Header": "SectionHeader",
"Table": "Table",
"Text": "Text",
"Complex-Block": "Figure",
"Code-Block": "Code",
"Form": "Form",
"Table-Of-Contents": "TableOfContents",
"Figure": "Figure",
"Chemical-Block": "ChemicalBlock",
"Diagram": "Diagram",
"Bibliography": "Bibliography",
"Blank-Page": "BlankPage",
}