A lightweight document
layout detection
model used by
Surya
. It detects layout regions
(text, tables, figures, headers, captions, equations, etc.) on a page image and
runs on CPU or GPU.
This is the "fast" layout detector — a compact object detector that serves as a
drop-in alternative to Surya's VLM-based layout model.
➡️
Documentation, installation, and everything else lives in the
Surya repository
.
Usage
Install Surya:
pip install surya-ocr
Point the fast layout predictor at this checkpoint:
from PIL import Image
from surya.fast_layout import FastLayoutPredictor
predictor = FastLayoutPredictor(checkpoint="hf://datalab-to/surya_layout2")
layout = predictor([Image.open("page.png")])
for box in layout[0].bboxes:
print(box.label, box.bbox, box.position) # region label, [x0,y0,x1,y1], reading-order index
Or make it the default so the CLI and library use it without an explicit path:
surya_layout2 huggingface.co is an AI model on huggingface.co that provides surya_layout2's model effect (), which can be used instantly with this datalab-to surya_layout2 model. huggingface.co supports a free trial of the surya_layout2 model, and also provides paid use of the surya_layout2. Support call surya_layout2 model through api, including Node.js, Python, http.
surya_layout2 huggingface.co is an online trial and call api platform, which integrates surya_layout2's modeling effects, including api services, and provides a free online trial of surya_layout2, you can try surya_layout2 online for free by clicking the link below.
datalab-to surya_layout2 online free url in huggingface.co:
surya_layout2 is an open source model from GitHub that offers a free installation service, and any user can find surya_layout2 on GitHub to install. At the same time, huggingface.co provides the effect of surya_layout2 install, users can directly use surya_layout2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.