createFromAsset static method

Future<NLClassifier> createFromAsset(
  1. String assetPath, {
  2. NLClassifierOptions? options,
})

Create NLClassifier directly from assetPath and optional options.

assetPath must the full path to assets. Eg. 'assets/my_model.tflite'.

throws FileSystemException If model file fails to load.

Implementation

static Future<NLClassifier> createFromAsset(String assetPath,
    {NLClassifierOptions? options}) async {
  final modelFile = await FileUtil.loadFileOnDevice(assetPath);
  return create(modelFile.path, options: options);
}