Skip to content

Instantly share code, notes, and snippets.

@Terieyenike
Created August 21, 2024 09:21
Show Gist options
  • Select an option

  • Save Terieyenike/79079fafd7f0d18953600ea821d18926 to your computer and use it in GitHub Desktop.

Select an option

Save Terieyenike/79079fafd7f0d18953600ea821d18926 to your computer and use it in GitHub Desktop.
Transcriptions with Whisper
import os
from dotenv import load_dotenv
from openai import OpenAI
client = OpenAI()
api_key = os.getenv('OPENAI_API_KEY')
file = 'audio/rr.mp3'
with open(file, 'rb') as audio_file:
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcript.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment