Skip to main content
Version: Next

VerticalOCRModule

TypeScript API implementation of the useVerticalOCR hook.

API Reference

High Level Overview

import { VerticalOCRModule, OCR_ENGLISH } from 'react-native-executorch';

const imageUri = 'path/to/image.png';

// Creating an instance
const verticalOCRModule = new VerticalOCRModule();

// Loading the model
await verticalOCRModule.load(OCR_ENGLISH);

// Running the model
const detections = await verticalOCRModule.forward(imageUri);

Methods

All methods of VerticalOCRModule are explained in details here: VerticalOCRModule API Reference

Loading the model

To load the model, use the load method. It accepts an object:

This method returns a promise, which can resolve to an error or void.

For more information on loading resources, take a look at loading models page.

Running the model

To run the model, you can use the forward method. It accepts one argument, which is the image. The image can be a remote URL, a local file URI, or a base64-encoded image. The method returns a promise, which can resolve either to an error or an array of OCRDetection objects. Each object contains coordinates of the bounding box, the label of the detected object, and the confidence score.