From 309869c494aefafb2f0da44a378fe36889ea6b71 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:19:38 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20=E9=9D=9E?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=E8=A8=80=E8=AA=9E=E3=81=AE=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AB=E6=96=87=E5=AD=97=E8=B5=B7=E3=81=93=E3=81=97=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=AE=E4=BE=8B=E5=A4=96=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E3=83=91=E3=82=B9=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transcription/transcription_transcriber.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src-python/models/transcription/transcription_transcriber.py b/src-python/models/transcription/transcription_transcriber.py index e2ab95b7..35a80e56 100644 --- a/src-python/models/transcription/transcription_transcriber.py +++ b/src-python/models/transcription/transcription_transcriber.py @@ -58,12 +58,16 @@ class AudioTranscriber: case "Google": confidences = [] for language, country in zip(languages, countries): - text, confidence = self.audio_recognizer.recognize_google( - audio_data, - language=transcription_lang[language][country][self.transcription_engine], - with_confidence=True - ) - confidences.append({"confidence": confidence, "text": text, "language": language}) + try: + text, confidence = self.audio_recognizer.recognize_google( + audio_data, + language=transcription_lang[language][country][self.transcription_engine], + with_confidence=True + ) + confidences.append({"confidence": confidence, "text": text, "language": language}) + except Exception: + pass + result = max(confidences, key=lambda x: x["confidence"]) case "Whisper":