-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from deepgram/sr/update-sample-app
example program.cs updated for remote and local file
- Loading branch information
Showing
3 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
using Deepgram.Transcription; | ||
using Newtonsoft.Json; | ||
|
||
namespace SampleApp | ||
{ | ||
class Program | ||
{ | ||
const string API_KEY = "DEEPGRAM_API_KEY"; | ||
const string API_KEY = "YOUR_DEEPGRAM_API_KEY"; | ||
|
||
static async Task Main(string[] args) | ||
{ | ||
DeepgramClient deepgram = new DeepgramClient(new Credentials(API_KEY)); | ||
var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync( | ||
new UrlSource("https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"), | ||
{ | ||
var credentials = new Credentials(API_KEY); | ||
DeepgramClient deepgram = new DeepgramClient(credentials); | ||
|
||
// UNCOMMENT IF USING LOCAL FILE: | ||
// using (FileStream fs = File.OpenRead("preamble.wav")) | ||
{ | ||
var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync( | ||
// UNCOMMENT IF USING LOCAL FILE: | ||
// new Deepgram.Transcription.StreamSource( | ||
// fs, | ||
// "audio/wav"), | ||
new Deepgram.Transcription.UrlSource("https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"), | ||
new PrerecordedTranscriptionOptions() | ||
{ | ||
Punctuate = true, | ||
Utterances = true, | ||
Redaction = new [] { "pci", "ssn" } | ||
}); | ||
|
||
Console.Write(response.ToWebVTT()); | ||
Console.WriteLine(JsonConvert.SerializeObject(response)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.