return nothing on error in get_transcription

This commit is contained in:
SevaSk 2023-05-30 07:37:56 -04:00
parent 0227cc7fcb
commit acff32780b

View File

@ -19,6 +19,7 @@ class WhisperTranscriber:
result = self.audio_model.transcribe(wav_file_path, fp16=torch.cuda.is_available()) result = self.audio_model.transcribe(wav_file_path, fp16=torch.cuda.is_available())
except Exception as e: except Exception as e:
print(e) print(e)
return ''
return result['text'].strip() return result['text'].strip()
class APIWhisperTranscriber: class APIWhisperTranscriber:
@ -30,5 +31,6 @@ class APIWhisperTranscriber:
result = openai.Audio.translate("whisper-1", audio_file) result = openai.Audio.translate("whisper-1", audio_file)
except Exception as e: except Exception as e:
print(e) print(e)
return ''
return result['text'].strip() return result['text'].strip()