Skip to content

Instantly share code, notes, and snippets.

@mseeks
Created February 8, 2024 02:20
Show Gist options
  • Save mseeks/9880a8fe5cc36c6c6f5992a4d4a4a434 to your computer and use it in GitHub Desktop.
Save mseeks/9880a8fe5cc36c6c6f5992a4d4a4a434 to your computer and use it in GitHub Desktop.
Python code for transcribing audio using OpenAI's Whisper model.
import whisper
model = whisper.load_model("base")
# Load your audio file
audio_path = "path/to/your/audio.mp3"
# Transcribe the audio file
def transcribe_audio(audio_path):
result = model.transcribe(audio_path)
return result["text"]
# Example usage
transcription = transcribe_audio(audio_path)
print(transcription)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment