loadModel static method

void loadModel(
  1. String? modelPath,
  2. DocumentModel documentModel,
  3. ProcessingUnit processingUnit
)

Loads a model into memory from the specified directory.

param modelPath The path to directory containing the AI model files. param documentModel The AI model to be loaded. param processingUnit Processing unit to load the model into. throws DocumentException An error has occurred during Document Library execution.

Implementation

static void loadModel(String? modelPath, DocumentModel documentModel, ProcessingUnit processingUnit) {
  Pointer<Char>? pModelPath = modelPath?.toNativeUtf8().cast<Char>();
  try {
    var err = documentSDK.id3DocumentLibrary_LoadModel(pModelPath ?? nullptr, documentModel.value, processingUnit.value);
    if (err != DocumentError.success.value) {
      throw DocumentException(err);
    }
  } finally {
    if (pModelPath != null) {
      calloc.free(pModelPath);
    }
  }
}