Typo fixed in variable names (#5184)

This commit is contained in:
Philipp Claßen 2024-01-06 07:05:03 +01:00 committed by GitHub
parent 91c2b8e11c
commit 3eca20c015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,13 +174,13 @@ async def handle_audio_transcription(request: Request):
# Create AudioData object # Create AudioData object
audio_data = sr.AudioData(raw_data, audio_data.frame_rate, audio_data.sample_width) audio_data = sr.AudioData(raw_data, audio_data.frame_rate, audio_data.sample_width)
whipser_language = form.getvalue('language', None) whisper_language = form.getvalue('language', None)
whipser_model = form.getvalue('model', 'tiny') # Use the model from the form data if it exists, otherwise default to tiny whisper_model = form.getvalue('model', 'tiny') # Use the model from the form data if it exists, otherwise default to tiny
transcription = {"text": ""} transcription = {"text": ""}
try: try:
transcription["text"] = r.recognize_whisper(audio_data, language=whipser_language, model=whipser_model) transcription["text"] = r.recognize_whisper(audio_data, language=whisper_language, model=whisper_model)
except sr.UnknownValueError: except sr.UnknownValueError:
print("Whisper could not understand audio") print("Whisper could not understand audio")
transcription["text"] = "Whisper could not understand audio UnknownValueError" transcription["text"] = "Whisper could not understand audio UnknownValueError"