0
0
Prompt Engineering / GenAIml~10 mins

Audio transcription (Whisper) in Prompt Engineering / GenAI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load the Whisper model for transcription.

Prompt Engineering / GenAI
import whisper
model = whisper.load_model([1])
Drag options to blanks, or click blank then click option'
A"tiny"
B"fast"
C"large-v2"
D"small"
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid model name like 'fast' which does not exist.
Forgetting to put the model name in quotes.
2fill in blank
medium

Complete the code to transcribe audio using the Whisper model.

Prompt Engineering / GenAI
result = model.transcribe([1])
Drag options to blanks, or click blank then click option'
Atranscription
Baudio_data
C"audio.wav"
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the model object instead of the audio filename.
Passing a variable that is not the audio file path.
3fill in blank
hard

Fix the error in accessing the transcribed text from the result dictionary.

Prompt Engineering / GenAI
text = result[[1]]
Drag options to blanks, or click blank then click option'
A"transcription"
B"text"
C"result"
D"output"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transcription' or 'output' as keys which do not exist.
Trying to access the result as an attribute instead of a dictionary key.
4fill in blank
hard

Fill both blanks to load the model and transcribe an audio file.

Prompt Engineering / GenAI
model = whisper.load_model([1])
result = model.transcribe([2])
Drag options to blanks, or click blank then click option'
A"base"
B"audio.mp3"
C"audio.wav"
D"large"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing model names and audio file names.
Using unsupported audio file formats.
5fill in blank
hard

Fill all three blanks to extract the transcribed text and print it.

Prompt Engineering / GenAI
model = whisper.load_model([1])
result = model.transcribe([2])
print(result[[3]])
Drag options to blanks, or click blank then click option'
A"small"
B"speech.mp3"
C"text"
D"tiny"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys to access the transcription.
Passing incorrect file names or model names.