Speech recognition converts recorded speech into text, making spoken information searchable and enabling voice-based applications. A practical workflow sends an audio file to Whisper and receives its transcription as text. section 7.2 section 7.2.1
Meeting recordings
Automatically transcribing recorded employee meetings creates text that can be searched for information relevant to a team, without listening to every recording. section 7.2
Listing 7.1 Transcribing audio files to text
import argparse
import openai
client = openai.OpenAI()
def transcribe(audio_path): #1
""" Transcribe audio file to text.
Args:
audio_path: path to audio file.
Returns:
transcribed text.
"""
with open(audio_path, 'rb') as audio_file:
transcription = client.audio.transcriptions.create(
file=audio_file, model='whisper-1')
return transcription.text
if __name__ == '__main__': #2
parser = argparse.ArgumentParser()
parser.add_argument('audiopath', type=str, help='Path to audio file')
args = parser.parse_args()
transcript = transcribe(args.audiopath)
print(transcript)
This Python program accepts an audio-file path, opens the file in binary-read mode, requests transcription with Whisper, and prints the returned text. section 7.2.2
Short audio transcription
A sample recording produces the transcript: “Two years ago, right here on this spot, I had a recurrent dream, too.” section 7.2.3





