react-native-executorch
Version:
An easy way to run AI models in React Native with ExecuTorch
20 lines (19 loc) • 761 B
JavaScript
import { VerticalOCRController } from '../../controllers/VerticalOCRController';
export class VerticalOCRModule {
static module;
static async load(model, independentCharacters, onDownloadProgressCallback = () => { }) {
this.module = new VerticalOCRController({
modelDownloadProgressCallback: onDownloadProgressCallback,
});
await this.module.loadModel({
detectorLarge: model.detectorLarge,
detectorNarrow: model.detectorNarrow,
}, {
recognizerLarge: model.recognizerLarge,
recognizerSmall: model.recognizerSmall,
}, model.language, independentCharacters);
}
static async forward(input) {
return await this.module.forward(input);
}
}