indra-ocr (browser)
The indra-ocr ONNX models (tag v3.1.1) plus a browser loader that runs them on onnxruntime-web (wasm). The pre/post-processing is ported from the indra-ocr Python package.
<script type="importmap">
{ "imports": {
"onnxruntime-web": "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.30.0/dist/ort.wasm.bundle.min.mjs"
} }
</script>
<script type="module">
import { loadIndra, readGrayBrowser } from
"https://huggingface.co/tomngdev/indra-ocr-web/resolve/main/indra-ocr-web.mjs";
const ocr = await loadIndra("https://huggingface.co/tomngdev/indra-ocr-web/resolve/main");
const gray = await readGrayBrowser("page.png"); // -> {data, width, height}
const page = await ocr.__call__(gray); // {lines: [{box, text, conf}], text, rotation}
console.log(page.text);
</script>
In a bundler/npm app, skip the importmap and install onnxruntime-web.
Options: loadIndra(base, { cjk: false, orient: false, order: false }) skips
optional models. Without cross-origin isolation (COOP/COEP) the wasm backend
runs single-threaded.
License
- ONNX models are licensed under OpenRAIL-M
- Code is licensed under Apache-2
- Downloads last month
- 5
Model tree for tomngdev/indra-ocr-web
Base model
datalab-to/indra-ocr