createFromAsset static method

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

Create BertNLClassifier 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<BertNLClassifier> createFromAsset(String assetPath,
    {BertNLClassifierOptions? options}) async {
  final modelFile = await FileUtil.loadFileOnDevice(assetPath);
  return create(modelFile.path, options: options);
}