navidc-ocr-demo / README.md
multimodalart's picture
multimodalart HF Staff
Add single-region mode, code fence languages, measured GPU duration
30a9ce4 verified
|
Raw
History Blame Contribute Delete
2.06 kB
---
title: NaviDC-OCR
emoji: πŸ“„
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 5.50.0
app_file: app.py
short_description: Parse digital & photographed documents into Markdown
python_version: "3.12"
startup_duration_timeout: 30m
license: apache-2.0
models:
- StarDoc-AI/NaviDC-OCR
pinned: false
---
# NaviDC-OCR
Demo of [StarDoc-AI/NaviDC-OCR](https://huggingface.co/StarDoc-AI/NaviDC-OCR), a 1.2B
document-parsing vision-language model that unifies **digital** and
**camera-captured** documents
([paper](https://huggingface.co/papers/2608.12898) Β·
[code](https://github.com/caipeng328/NaviDC-OCR)).
The app follows the authors' two-stage pipeline:
1. **Layout** β€” the page is resized to 1036Γ—1036 and the model emits
reading-ordered regions. `Detection` mode returns axis-aligned boxes (digital
pages, flat scans); `Segmentation` mode returns multi-point polygons, which is
the paper's geometry-aware path for photographed, curved or crumpled pages.
2. **Recognition** β€” each region is cropped (polygon-masked and de-rotated where
needed) and recognized with the block-type-specific prompt and sampling
parameters from the reference implementation. Tables come back as OTSL and are
converted to HTML, equations to LaTeX, using the authors' post-processors
(vendored under `NaviOCR/`).
A third **Single region** mode skips layout and runs the authors' one-block path
(`block_parse`) over the whole image with the prompt for a chosen block type β€”
table, formula, code, seal, or a chart / scientific figure, which the model
converts into the table it implies.
Outputs: rendered document, Markdown source, layout overlay, and the raw block
list as JSON.
## Credits
Example pages are the official assets from the
[NaviDC-OCR model card](https://huggingface.co/StarDoc-AI/NaviDC-OCR/tree/main/assets)
(Apache-2.0). The `NaviOCR/` package is a trimmed copy of the authors'
[reference implementation](https://github.com/caipeng328/NaviDC-OCR) (Apache-2.0),
limited to the modules needed for the transformers backend.