Skip to content

Commit

Permalink
Merge pull request #102 from deepgram/sr/update-sample-app
Browse files Browse the repository at this point in the history
example program.cs updated for remote and local file
  • Loading branch information
SandraRodgers authored Jul 3, 2023
2 parents 8a143d1 + 0329240 commit 8e7c302
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
24 changes: 17 additions & 7 deletions SampleApp/Program.cs
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));
}
}
}
}
3 changes: 3 additions & 0 deletions SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
<ItemGroup>
<Using Include="Deepgram" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

</Project>
Binary file added SampleApp/preamble.wav
Binary file not shown.

0 comments on commit 8e7c302

Please sign in to comment.