sendInference method
Future<List<Map<String, dynamic> > >
sendInference(
- String modelPath,
- Float32List audioData, {
- String? ortDylibPathOverride,
Sends audio data for inference.
Returns the processed segments. Throws if the isolate encounters an error.
Implementation
Future<List<Map<String, dynamic>>> sendInference(
String modelPath,
Float32List audioData, {
String? ortDylibPathOverride,
}) async {
await start();
final response = ReceivePort();
final message = PyannoteIsolateMessage(
replyPort: response.sendPort,
modelPath: modelPath,
audioData: audioData,
ortDylibPathOverride: ortDylibPathOverride,
);
_sendPort!.send(message);
final dynamic result = await response.first;
if (result is List<Map<String, dynamic>>) {
return result;
} else if (result is Error) {
throw result;
} else if (result is PyannoteException) {
throw result;
} else {
throw Exception(
'Unknown error in Pyannote isolate. Output type: ${result.runtimeType} ${result.toString()}',
);
}
}