diff --git a/lollms/app.py b/lollms/app.py index b64dfed..fe2bd8c 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -71,6 +71,20 @@ class LollmsApplication(LoLLMsCom): self.generate_msg_with_internet: Callable[[str, Dict], None] = None self.handle_continue_generate_msg_from: Callable[[str, Dict], None] = None + + # services + self.ollama = None + self.vllm = None + self.whisper = None + self.xtts = None + self.sd = None + self.comfyui = None + self.motion_ctrl = None + + self.tti = None + self.tts = None + self.stt = None + self.rt_com = None if not free_mode: try: @@ -228,17 +242,7 @@ class LollmsApplication(LoLLMsCom): return self.lollms_paths.personal_uploads_path def start_servers(self): - self.ollama = None - self.vllm = None - self.whisper = None - self.xtts = None - self.sd = None - self.comfyui = None - self.motion_ctrl = None - self.tti = None - self.tts = None - self.stt = None diff --git a/lollms/com.py b/lollms/com.py index 79a9c70..3d643f2 100644 --- a/lollms/com.py +++ b/lollms/com.py @@ -41,6 +41,11 @@ class LoLLMsCom: def __init__(self, sio:socketio.AsyncServer=None, verbose:bool=False) -> None: self.sio= sio self.verbose = verbose + self.tti = None + self.tts = None + self.stt = None + + self.rt_com = None def InfoMessage(self, content, client_id=None, verbose:bool=None): diff --git a/lollms/databases/discussions_database.py b/lollms/databases/discussions_database.py index 0c17956..5c48193 100644 --- a/lollms/databases/discussions_database.py +++ b/lollms/databases/discussions_database.py @@ -644,7 +644,6 @@ class Discussion: self.discussion_rag_folder.mkdir(exist_ok=True) self.discussion_view_images_folder.mkdir(exist_ok=True) self.messages = self.get_messages() - self.whisper= None if len(self.messages)>0: self.current_message = self.messages[-1] @@ -731,22 +730,14 @@ class Discussion: self.audio_files.append(path) if process: self.lollms.new_message(client.client_id if client is not None else 0, content = "", message_type = MSG_TYPE.MSG_TYPE_FULL) + if self.lollms.stt is None: + self.lollms.info("Please select an stt engine in the services settings first") self.lollms.info(f"Transcribing ... ") - if self.whisper is None: - if not PackageManager.check_package_installed("whisper"): - PackageManager.install_package("openai-whisper") - try: - import conda.cli - conda.cli.main("install", "conda-forge::ffmpeg", "-y") - except: - ASCIIColors.bright_red("Couldn't install ffmpeg. whisper won't work. Please install it manually") - - import whisper - self.whisper = whisper.load_model("base") - result = self.whisper.transcribe(str(path)) + result = self.lollms.stt.transcribe(str(path)) transcription_fn = str(path)+".txt" with open(transcription_fn, "w", encoding="utf-8") as f: f.write(result["text"]) + self.text_files.append(transcription_fn) tasks_library.info(f"Transcription saved to {transcription_fn}") elif path.suffix in [".png",".jpg",".jpeg",".gif",".bmp",".svg",".webp"]: