initModel method

void initModel()

Implementation

void initModel() {
  if (model is String) {
    final modelString = model as String;
    ctx = WhisperLibrary.binding.whisper_init_from_file_with_params(
        modelString.toNativeUtf8().cast<Char>(), cparams);
  } else if (model is Uint8List) {
    final modelList = model as Uint8List;
    var ptr = allocateUint8Pointer(modelList);
    ctx = WhisperLibrary.binding.whisper_init_from_buffer_with_params(
        ptr.cast(), modelList.length, cparams);
  } else {
    throw Exception("Invalid mode");
  }
}