mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-01-21 03:55:01 +00:00
fixed error
This commit is contained in:
parent
cb090d32fd
commit
b5b92865b6
@ -354,18 +354,18 @@ class RTCom:
|
||||
# self.transcription_signal.update_status.emit("Transcribing")
|
||||
self.lc.info("Transcribing")
|
||||
ASCIIColors.green("<<TRANSCRIBING>>")
|
||||
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()
|
||||
|
@ -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"]
|
||||
|
@ -44,8 +44,8 @@ class LollmsSTT:
|
||||
def transcribe(
|
||||
self,
|
||||
wav_path: str | Path,
|
||||
prompt=""
|
||||
):
|
||||
prompt:str=""
|
||||
)->str:
|
||||
"""
|
||||
Transcribes the given audio file to text.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user