react-native-executorch
Version:
An easy way to run AI models in React Native with ExecuTorch
19 lines (18 loc) • 896 B
JavaScript
import { Platform } from 'react-native';
const LINKING_ERROR = `The package 'react-native-executorch' doesn't seem to be linked. Make sure: \n\n` +
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n';
function returnSpecOrThrowLinkingError(spec) {
return spec
? spec
: new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
},
});
}
const OCRNativeModule = returnSpecOrThrowLinkingError(require('./NativeOCR').default);
const VerticalOCRNativeModule = returnSpecOrThrowLinkingError(require('./NativeVerticalOCR').default);
const ETInstallerNativeModule = returnSpecOrThrowLinkingError(require('./NativeETInstaller').default);
export { OCRNativeModule, VerticalOCRNativeModule, ETInstallerNativeModule };