Skip to main content
Version: 0.10.0

Function: useOpticalCharacterRecognizer()

useOpticalCharacterRecognizer(config, options?): object

Defined in: hooks/useOpticalCharacterRecognizer.ts:21

React hook for the PP-OCRv6 pipeline.

It downloads and loads the model, tracks progress and errors, instantiates the task runner, and cleans up native memory on unmount or config change. Heavy work runs on a worklet thread; recognizeCharacters resolves with the recognized regions in reading order.

For imperative usage, see createPaddleOcr.

Parameters

config

PaddleOcrModel

OCR model configuration. Use a preset from models.ocr.*.

options?

ResourceOptions

Load and caching options. See ResourceOptions.

Returns

object

The same object as PaddleOcr (without dispose), combined with loading state, download progress, and resource info.

downloadProgress

downloadProgress: any

error

error: any

isReady

isReady: boolean = !!model

recognizeCharacters

recognizeCharacters: any = model.recognizeCharacters

recognizeCharactersWorklet

recognizeCharactersWorklet: any = model.recognizeCharactersWorklet

resource

resource: any

See

PaddleOcr