.NET API Usage example¶
Examples are from native_client/dotnet/DeepSpeechConsole/Program.cs.
Creating a model instance and loading model¶
57 58 | using (IDeepSpeech sttClient = new DeepSpeech(model ?? "output_graph.pbmm"))
{
|
Performing inference¶
93 94 95 96 97 98 99 100 101 102 103 | 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
.