.NET API Usage example¶
Examples are from native_client/dotnet/DeepSpeechConsole/Program.cs.
Creating a model instance and loading model¶
55 56 | using (IDeepSpeech sttClient = new DeepSpeech(model ?? "output_graph.pbmm"))
{
|
Performing inference¶
78 79 80 81 82 83 84 85 86 87 88 | if (extended)
{
Metadata metaResult = sttClient.SpeechToTextWithMetadata(waveBuffer.ShortBuffer,
Convert.ToUInt32(waveBuffer.MaxSize / 2), 1);
speechResult = MetadataToString(metaResult.Transcripts[0]);
}
else
{
speechResult = sttClient.SpeechToText(waveBuffer.ShortBuffer,
Convert.ToUInt32(waveBuffer.MaxSize / 2));
}
|
Full source code¶
See Full source code
.