openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
examples/Audio/Example02_SimpleTranscription.cs
21lines · modecode
| 1 | using NUnit.Framework; |
| 2 | using OpenAI.Audio; |
| 3 | using System; |
| 4 | using System.IO; |
| 5 | |
| 6 | namespace OpenAI.Examples; |
| 7 | |
| 8 | public partial class AudioExamples |
| 9 | { |
| 10 | [Test] |
| 11 | public void Example02_SimpleTranscription() |
| 12 | { |
| 13 | AudioClient client = new("whisper-1", Environment.GetEnvironmentVariable("OPENAI_API_KEY")); |
| 14 | |
| 15 | string audioFilePath = Path.Combine("Assets", "audio_houseplant_care.mp3"); |
| 16 | |
| 17 | AudioTranscription transcription = client.TranscribeAudio(audioFilePath); |
| 18 | |
| 19 | Console.WriteLine($"{transcription.Text}"); |
| 20 | } |
| 21 | } |
| 22 | |