Get started with ONNX Runtime for React Native

Contents

Install

# install latest release version
npm install onnxruntime-react-native

Import

// use ES6 style import syntax (recommended)
import * as ort from 'onnxruntime-react-native';
// or use CommonJS style import syntax
const ort = require('onnxruntime-react-native');

Enable ONNX Runtime Extensions for React Native

To enable support for ONNX Runtime Extensions in your React Native app, you need to specify the following configuration as a top-level entry (note: usually where the package nameand versionfields are) in your project’s root directory package.json file.

"onnxruntimeExtensionsEnabled": "true"