mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-01-21 12:05:09 +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.transcription_signal.update_status.emit("Transcribing")
|
||||||
self.lc.info("Transcribing")
|
self.lc.info("Transcribing")
|
||||||
ASCIIColors.green("<<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"
|
transcription_fn = str(Path(self.logs_folder)/filename) + ".txt"
|
||||||
with open(transcription_fn, "w", encoding="utf-8") as f:
|
with open(transcription_fn, "w", encoding="utf-8") as f:
|
||||||
f.write(result["text"])
|
f.write(transcription)
|
||||||
|
|
||||||
with self.transcribed_lock:
|
with self.transcribed_lock:
|
||||||
self.transcribed_files.append((filename, result["text"]))
|
self.transcribed_files.append((filename, transcription))
|
||||||
self.transcribed_lock.notify()
|
self.transcribed_lock.notify()
|
||||||
if result["text"]!="":
|
if transcription!="":
|
||||||
current_prompt = result["text"]
|
current_prompt = transcription
|
||||||
# TODO : send the output
|
# 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
|
# TODO : send the output
|
||||||
# self.transcription_signal.update_status.emit("Generating answer")
|
# 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)
|
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 the result is not empty, call the callback
|
||||||
if result:
|
if result:
|
||||||
self.callback(result["text"])
|
self.callback(transcription)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# If the user hits Ctrl+C, stop the stream
|
# If the user hits Ctrl+C, stop the stream
|
||||||
self.stop()
|
self.stop()
|
||||||
|
@ -37,6 +37,6 @@ class LollmsWhisper(LollmsSTT):
|
|||||||
def transcribe(
|
def transcribe(
|
||||||
self,
|
self,
|
||||||
wave_path: str|Path
|
wave_path: str|Path
|
||||||
):
|
)->str:
|
||||||
result = self.whisper.transcribe(str(wave_path))
|
result = self.whisper.transcribe(str(wave_path))
|
||||||
return result
|
return result["text"]
|
||||||
|
@ -44,8 +44,8 @@ class LollmsSTT:
|
|||||||
def transcribe(
|
def transcribe(
|
||||||
self,
|
self,
|
||||||
wav_path: str | Path,
|
wav_path: str | Path,
|
||||||
prompt=""
|
prompt:str=""
|
||||||
):
|
)->str:
|
||||||
"""
|
"""
|
||||||
Transcribes the given audio file to text.
|
Transcribes the given audio file to text.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user