datalab-to/surya
60.6
Adequate · 16 November 2026
5.7k
lines of production code
Python
primary language
5
measurements over time
What this system is
Features
Introduce dual-mode table structure recognition
The \surya/table\_rec\ module now provides a \TableRecPredictor\ with two distinct recognition modes. The default 'simple' mode predicts rows and columns, deriving cells geometrically from their intersections, which is suitable for standard grid structures. The new 'full' mode uses a block prompt to generate complete HTML output, supporting complex table features like colspan, rowspan, and headers, with the resulting HTML accessible via the \TableResult.html\ property for direct consumption by downstream tools.
_surya/table\rec · high confidence
Introduce fast-layout detection with reading-order support and shared server architecture
Surya now includes a new fast-layout predictor (surya.fast\_layout) that uses a lightweight rf-detr object detector instead of the previous VLM-based approach, providing significantly faster page layout analysis. This new component introduces autoregressive reading-order detection, allowing the layout engine to determine the correct reading sequence of detected text blocks. To optimize resource usage, the fast-layout model runs in a single shared server process that coalesces requests from multiple client processes, reducing memory overhead and improving throughput. The system also includes a new screenshot application (surya\_screenshot.html) for visualizing full-page OCR results with layout boxes. Additionally, the old detection and processing modules (surya/detection.py, surya/model/processing.py, surya/model/segformer.py) have been removed as part of this architectural shift.
surya · high confidence
New PDF and image loading utilities
Added \surya/input/load.py\ and \surya/input/processing.py\ to provide standardized functions for loading PDFs and images. The new \load\_from\_file\ and \load\_from\_folder\ functions automatically detect file types (using \filetype\) and handle page ranges and DPI settings for PDFs, while \load\_image\ handles single image files. The underlying \processing.py\ module uses \pypdfium2\ to render PDF pages to PIL images.
surya/input · high confidence
New block-based OCR recognition predictor with full-page fallback
The recognition module now uses a new RecognitionPredictor that performs per-block OCR by cropping layout-defined regions and running a block-specific prompt, while also supporting a full-page OCR mode that includes automatic detection and removal of blank text blocks and handling of repetition loops. This change introduces a more granular approach to text extraction, allowing for better handling of complex layouts and improved accuracy through full-page regeneration strategies when needed.
surya/recognition · high confidence
New debug visualization tools for bounding boxes and HTML rendering
Added a suite of new modules in the \surya/debug\ package to support visual debugging and HTML export. \draw.py\ and \text.py\ provide utilities for drawing bounding boxes and polygons on images with labels, while \fonts.py\ handles automatic font downloading and path resolution. Additionally, \render\_html.py\ and \katex.js\ enable rendering text content as HTML with support for KaTeX math expressions, allowing users to export debug views as styled web pages. Also in this area: 1 commit (1 fix) fixing surya.
surya/debug · medium confidence · unverified
New llama.cpp and vLLM inference backends with auto-scaling concurrency
The inference system now supports two new execution backends: llama.cpp (spawning the native \llama-server\ binary) and vLLM (spawning a Docker container). These backends share a common OpenAI-compatible client for batch processing, enabling structured outputs and retry logic. The vLLM backend introduces auto-scaling client concurrency that adjusts parallel requests based on detected GPU VRAM, capping at 96 concurrent requests to avoid GPU saturation.
surya/inference/backends · high confidence
New modular CLI scripts and dedicated screenshot viewer
The \surya/scripts\ package now provides a set of standalone, modular command-line tools for specific tasks: layout detection (\detect\_layout.py\), text detection (\detect\_text.py\), full-page OCR (\ocr\_text.py\), and table recognition (\table\_recognition.py\). These scripts share a common \CLILoader\ configuration class that standardizes input handling, output directories, and page-range selection. Additionally, a new screenshot-friendly web application (\screenshot\_app.py\) has been added, offering a side-by-side viewer for PDF/image pages and their OCR output, designed for easy visual inspection and screenshot capture. Also in this area: 1 commit (1 fix) fixing surya; 1 commit (0 fixes) modifying surya, surya-ocr.
surya/scripts · medium confidence · unverified
Project initialization with licensing, tooling, and dependency infrastructure
The repository has been initialized with the core project infrastructure, including the Apache 2.0 license for the codebase and a modified OpenRAIL-M license for the machine learning models, which imposes use-based restrictions for entities with significant revenue or funding. A Contributor License Agreement (CLA) and CITATION file have been added to manage contributions and academic attribution. Development tooling is established via a pre-commit configuration for Ruff linting and formatting, a pytest configuration, and a \uv.lock\ file pinning Python 3.10+ dependencies such as \aiohttp\.
(repo-wide) · high confidence
Removals
Removed legacy OpenCV-based postprocessing modules
The \surya/postprocessing\ module has removed the legacy OpenCV-based postprocessing logic, specifically deleting \affinity.py\, \heatmap.py\, and \util.py\. This eliminates the previous Sobel/Canny/Hough-based line detection, connected-component box detection, and manual bounding-box scaling utilities, indicating a shift to a different postprocessing implementation (likely model-driven) that no longer relies on these specific computer vision primitives.
surya/postprocessing · high confidence
Behavioural changes
Introduce SuryaInferenceManager with automatic backend selection
The inference layer now uses a centralized SuryaInferenceManager that automatically selects the optimal backend (vLLM for NVIDIA GPUs, llama.cpp for CPU/MPS) based on hardware detection, exposing a unified interface for layout, table, and block prediction tasks with configurable concurrency capacity.
surya/inference · high confidence
Introduces a new batch-service architecture with unified server lifecycle and typed inference schemas
Surya now uses a dedicated batch-service layer to manage model inference servers. This change adds a generic HTTP server with continuous batching (configurable via \batch\_wait\_ms\ and \max\_batch\) and a robust attach-or-spawn lifecycle manager that handles health checks, file locking, and cleanup. It also introduces a comprehensive set of Pydantic schemas for all inference tasks (layout, table, OCR, detection) and a \PolygonBox\ utility for coordinate handling, replacing previous ad-hoc data structures with a consistent, type-safe interface for model inputs and outputs. Also in this area: 1 commit (1 fix) fixing surya; Introduce shared common infrastructure for Surya models.
surya/common · medium confidence · unverified
Layout predictor now filters blank text regions and maps model labels to canonical names
The layout module now includes logic to detect and drop text-labeled layout blocks that correspond to blank or uniform-color image regions, reducing false positives for text detection. Additionally, raw labels emitted by the underlying foundation model are mapped to a canonical set of public label names (e.g., 'Image' becomes 'Picture', 'Equation-Block' becomes 'Equation'), ensuring consistent output for downstream consumers.
surya/layout · high confidence
Fixes
1 commit (1 fix) fixing surya
A fix in surya — 1 commit (1 fix), 102 files: “Release v0.24.0: Surya 2.5 VLM cleanup, interactive viewer, CLI improvements, and bug fixes”.
surya/skills · medium confidence · unverified
Test coverage
Initial test suite for Surya prediction models
Added a comprehensive test suite covering the core prediction components: detection, layout, recognition, table recognition, and OCR error detection. The tests verify that predictors load correctly, process sample images, and return expected result structures (such as bounding boxes, reading orders, and cell grids). A specific regression test ensures that model checkpoint weights are loaded correctly without being overwritten by initialization routines. Additionally, tests for the fast-layout server validate engine correctness, continuous batching behavior, and box-merging logic. Also in this area: 1 commit adding/updating tests in tests.
tests · high confidence · unverified
Dependencies
Migrate from Poetry to Hatch and upgrade core dependencies
The project has switched its build system from Poetry to Hatch (pyproject.toml), replacing the deleted poetry.lock with a new dependency specification. This update renames the package to surya-ocr, raises the minimum Python version to 3.10, and significantly upgrades core libraries: transformers is bumped to \>=5.12.1, torch to \>=2.7.0, and torchvision to \>=0.20.0. Other dependencies such as pypdfium2 (\>=5.10.1) and opencv-python-headless (==4.11.0.86) have also been updated to newer versions.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 47.3 → 60.6 (+13.3)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 77.6 → 65.8 (-11.8)
- Architecture 88.2 → 97.7 (+9.5)
- Maturity 56.0 → 59.0 (+3.0)
- Readiness 35.8 → 56.7 (+20.9)
- Security 68.7 → 62.5 (-6.2)
Resolved (45)
- Change coupling: init.py ↔ init.py (surya/layout/init.py)
- Change coupling: init.py ↔ init.py (surya/ocr_error/init.py)
- Change coupling: loader.py ↔ loader.py (surya/detection/loader.py)
- Critical CVE: [GHSA redacted] (uv.lock)
- DetectionPredictor.batch_detection (cognitive 27) (surya/detection/init.py)
- Duplicated block (11 lines × 2) (surya/inference/backends/llamacpp.py)
- Duplicated block (11 lines × 2) (surya/inference/backends/vllm.py)
- Duplicated block (13–14 lines × 2) (surya/detection/model/encoderdecoder.py)
- Duplicated block (5 lines × 2) (surya/common/rfdetr/models/lwdetr.py)
- Duplicated block (6 lines × 2) (surya/common/rfdetr/models/backbone/init.py)
- Duplicated block (6 lines × 2) (surya/scripts/detect_layout.py)
- Duplicated block (7 lines × 2) (surya/detection/config.py)
- Duplicated block (7–8 lines × 2) (surya/scripts/streamlit_app.py)
- Duplicated block (8 lines × 2) (surya/scripts/screenshot_app.py)
- Duplicated block (9 lines × 3) (surya/scripts/detect_layout.py)
- FileTooLong: model/encoderdecoder.py (surya/detection/model/encoderdecoder.py)
- High CVE: [GHSA redacted] (uv.lock)
- High CVE: [GHSA redacted] (uv.lock)
- High vulnerability: [GHSA redacted] (uv.lock)
- LWDETR.forward (cognitive 36) (surya/common/rfdetr/models/lwdetr.py)
- …and 25 more
New (37)
- Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency
- Duplicated block (10 lines × 3) (surya/layout/init.py)
- Duplicated block (12 lines × 3) (surya/inference/backends/llamacpp.py)
- Duplicated block (14–20 lines × 2) (surya/layout/init.py)
- Duplicated block (15–17 lines × 2) (surya/inference/backends/llamacpp.py)
- Edited copy of a member (10 corresponding lines) (surya/inference/backends/mlx.py)
- Edited copy of a member (10 corresponding lines) (surya/inference/compact.py)
- Edited copy of a member (22 corresponding lines) (surya/inference/util.py)
- Edited copy of a member (34 corresponding lines) (surya/scripts/detect_layout.py)
- FileTooLong: scripts/viewer.py (surya/scripts/viewer.py)
- High CVE: [GHSA redacted] (uv.lock)
- Hotspot: surya/inference/backends/openai_client.py (surya/inference/backends/openai_client.py)
- Hotspot: surya/recognition/init.py (surya/recognition/init.py)
- LlamaCppBackend._generate_via_llama_cli (cognitive 24) (surya/inference/backends/llamacpp.py)
- LlamaCppBackend._generate_via_llama_cli (cyclomatic 19) (surya/inference/backends/llamacpp.py)
- Low coverage: surya/common/util.py (surya/common/util.py)
- Low coverage: surya/debug/draw.py (surya/debug/draw.py)
- Low coverage: surya/debug/fonts.py (surya/debug/fonts.py)
- Low coverage: surya/debug/text.py (surya/debug/text.py)
- Low coverage: surya/inference/backends/llamacpp.py (surya/inference/backends/llamacpp.py)
- …and 17 more
Changes since last survey
- 2 commits — 1 feature/other, 1 fixes
By area
- signatures/version1 — 1 commit
- surya/common — 1 commit
Notable commits
- fix: Release v0.24.0: Surya 2.5 VLM cleanup, interactive viewer, CLI improvements, and bug fixes
- change: @theluckystrike has signed the CLA in datalab-to/surya#570
Architecture
- Containers 0 added · 0 removed · contexts 0 added · 1 removed · edges 0 added · 0 removed
Removed bounded contexts (1)
- surya-ocr
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
datalab-to/surya was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 16 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 253888005c21865f0ded5d50872727f2a3b307f1 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.84+preprod-d645ca9bbedd.