From b5b92865b6b9be84fe786321beacde3033f16b03 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 20 May 2024 13:22:01 +0200 Subject: [PATCH] fixed error --- lollms/media.py | 14 +++++++------- lollms/services/whisper/lollms_whisper.py | 4 ++-- lollms/stt.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lollms/media.py b/lollms/media.py index c8a6b2e..95ff891 100644 --- a/lollms/media.py +++ b/lollms/media.py @@ -354,18 +354,18 @@ class RTCom: # self.transcription_signal.update_status.emit("Transcribing") self.lc.info("Transcribing") ASCIIColors.green("<>") - result = self.lc.stt.transcribe(str(Path(self.logs_folder)/filename)) + transcription = self.lc.stt.transcribe(str(Path(self.logs_folder)/filename)) transcription_fn = str(Path(self.logs_folder)/filename) + ".txt" with open(transcription_fn, "w", encoding="utf-8") as f: - f.write(result["text"]) + f.write(transcription) with self.transcribed_lock: - self.transcribed_files.append((filename, result["text"])) + self.transcribed_files.append((filename, transcription)) self.transcribed_lock.notify() - if result["text"]!="": - current_prompt = result["text"] + if transcription!="": + current_prompt = transcription # TODO : send the output - # self.transcription_signal.new_user_transcription.emit(filename, result["text"]) + # self.transcription_signal.new_user_transcription.emit(filename, transcription) # TODO : send the output # self.transcription_signal.update_status.emit("Generating answer") self.lc.new_block(client_id=self.client.client_id,sender=self.lc.config.user_name, content=current_prompt) @@ -567,7 +567,7 @@ class RealTimeTranscription: # If the result is not empty, call the callback if result: - self.callback(result["text"]) + self.callback(transcription) except KeyboardInterrupt: # If the user hits Ctrl+C, stop the stream self.stop() diff --git a/lollms/services/whisper/lollms_whisper.py b/lollms/services/whisper/lollms_whisper.py index f5c49f4..80b26ad 100644 --- a/lollms/services/whisper/lollms_whisper.py +++ b/lollms/services/whisper/lollms_whisper.py @@ -37,6 +37,6 @@ class LollmsWhisper(LollmsSTT): def transcribe( self, wave_path: str|Path - ): + )->str: result = self.whisper.transcribe(str(wave_path)) - return result + return result["text"] diff --git a/lollms/stt.py b/lollms/stt.py index 070460b..9f6605d 100644 --- a/lollms/stt.py +++ b/lollms/stt.py @@ -44,8 +44,8 @@ class LollmsSTT: def transcribe( self, wav_path: str | Path, - prompt="" - ): + prompt:str="" + )->str: """ Transcribes the given audio file to text.