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

Downloads last month
5
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for tomngdev/indra-ocr-web

Quantized
(6)
this model

Space using tomngdev/indra-ocr-web 1