mirror of
https://github.com/SevaSk/ecoute.git
synced 2024-12-20 05:07:53 +00:00
return nothing on error in get_transcription
This commit is contained in:
parent
0227cc7fcb
commit
acff32780b
@ -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()
|
Loading…
Reference in New Issue
Block a user