react-native-executorch
Version:
An easy way to run AI models in React Native with ExecuTorch
17 lines (16 loc) • 628 B
JavaScript
;
import { BaseModule } from '../BaseModule';
import { ResourceFetcher } from '../../utils/ResourceFetcher';
export class ExecutorchModule extends BaseModule {
async load(modelSource, onDownloadProgressCallback = () => {}) {
const paths = await ResourceFetcher.fetch(onDownloadProgressCallback, modelSource);
if (paths === null || paths.length < 1) {
throw new Error('Download interrupted.');
}
this.nativeModule = global.loadExecutorchModule(paths[0] || '');
}
async forward(inputTensor) {
return await this.forwardET(inputTensor);
}
}
//# sourceMappingURL=ExecutorchModule.js.map