From eb1f200faed96362e6ab0734d49af59e59262ffc Mon Sep 17 00:00:00 2001 From: ethanzrd Date: Mon, 14 Aug 2023 01:13:16 +0300 Subject: [PATCH] Implemented error handling for transcription call to resolve silence suppression issue. Resolved the 'Unknown Speaker' label incorrectly appearing in the client. --- backend/transcription/whisper_transcriber.py | 4 ++-- interface/src/TranscribeOutput.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/transcription/whisper_transcriber.py b/backend/transcription/whisper_transcriber.py index 5859c98..24354e8 100644 --- a/backend/transcription/whisper_transcriber.py +++ b/backend/transcription/whisper_transcriber.py @@ -71,8 +71,8 @@ def transcribe(self, audio): if aligned_transcription['text'] == "": logging.info("Empty aligned transcription, defaulting to original") return self.current_transcription - except ValueError: - logging.info("Transcription alignment failed, defaulting to original") + except Exception as e: + logging.info(f"Transcription alignment failed, defaulting to original. Error: {e}") return self.current_transcription return aligned_transcription diff --git a/interface/src/TranscribeOutput.js b/interface/src/TranscribeOutput.js index 28c4cdd..fef8939 100644 --- a/interface/src/TranscribeOutput.js +++ b/interface/src/TranscribeOutput.js @@ -23,7 +23,7 @@ const TranscribeOutput = ({ data, classes }) => { const text = item.text; let speakerName = ""; - if (speaker === -1) { + if (speaker === "unknown") { speakerName = "Unknown Speaker"; } else { speakerName = `Speaker ${speaker + 1}`;