Package Exports
- react-native-tflite-classification
- react-native-tflite-classification/lib/commonjs/index.js
- react-native-tflite-classification/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-tflite-classification) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-native-tflite-classification
Run TensorFlow Lite models in React Native Android apps.
Example
Please see the example app to get started!

Installation
npm install react-native-tflite-classification
Usage
const RNFS = require('react-native-fs');
import { Tflite } from 'react-native-tflite-classification';
let tflite = new Tflite()
// load model
tflite.loadModel({
// internal storage path to model. This library supports both regular and quanitzed TensorFlow Lite models.
modelPath: '/Model/graph.lite',
// internal storage path to labels. Labels file must have each label on new line.
labelsPath: '/Model/labels.txt'
},
(err, res) => {
if (err)
console.log(err);
else
console.log(res);
}
);
);
// run an image against loaded model
tflite.runModelOnImage({
// image path must be a uri and the image must be square
path: 'file://' + RNFS.DocumentDirectoryPath + '/example.jpg',
// maximum number of results to return from model. Results are ordered by confidence
numResults: 10,
// only return results that pass a cretain threshold of confidence
threshold: 0
},
(err, res) => {
if (err)
console.log(err + '\n' + res);
else {
console.log(results);
}
});
// Releases all resources used by the model on the native side
tflite.close()
License
MIT