create static method

BertNLClassifier create(
  1. String modelPath, {
  2. BertNLClassifierOptions? options,
})

Create BertNLClassifier from modelPath and optional options.

modelPath is the path of the .tflite model loaded on device.

throws FileSystemException If model file fails to load.

Implementation

static BertNLClassifier create(String modelPath,
    {BertNLClassifierOptions? options}) {
  if (options == null) {
    options = BertNLClassifierOptions();
  }
  final nativePtr = BertNLClassifierFromFileAndOptions(
      modelPath.toNativeUtf8(), options.base);
  if (nativePtr == nullptr) {
    throw FileSystemException(
        "Failed to create BertNLClassifier.", modelPath);
  }
  return BertNLClassifier._(nativePtr);
}