From 8966acc14719505a72567e49f4d78d912eac52ee Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 29 Jan 2024 22:21:45 +0100 Subject: [PATCH] upgraded --- events/lollms_interactive_events.py | 18 ++++++++++++++++-- lollms_core | 2 +- lollms_webui.py | 25 +------------------------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/events/lollms_interactive_events.py b/events/lollms_interactive_events.py index f7585bd6..19052c4e 100644 --- a/events/lollms_interactive_events.py +++ b/events/lollms_interactive_events.py @@ -40,7 +40,12 @@ def add_events(sio:socketio): @sio.on('start_webcam_video_stream') def start_webcam_video_stream(sid): lollmsElfServer.info("Starting video capture") - lollmsElfServer.webcam.start_capture() + try: + from lollms.media import WebcamImageSender + lollmsElfServer.webcam = WebcamImageSender(sio,lollmsCom=lollmsElfServer) + lollmsElfServer.webcam.start_capture() + except: + lollmsElfServer.InfoMessage("Couldn't load media library.\nYou will not be able to perform any of the media linked operations. please verify the logs and install any required installations") @sio.on('stop_webcam_video_stream') def stop_webcam_video_stream(sid): @@ -50,7 +55,16 @@ def add_events(sio:socketio): @sio.on('start_audio_stream') def start_audio_stream(sid): lollmsElfServer.info("Starting audio capture") - lollmsElfServer.audio_cap.start_recording() + try: + from lollms.media import AudioRecorder + lollmsElfServer.rec_output_folder = lollmsElfServer.lollms_paths.personal_outputs_path/"audio_rec" + lollmsElfServer.rec_output_folder.mkdir(exist_ok=True, parents=True) + lollmsElfServer.summoned = False + lollmsElfServer.audio_cap = AudioRecorder(sio,lollmsElfServer.rec_output_folder/"rt.wav", callback=lollmsElfServer.audio_callback,lollmsCom=lollmsElfServer) + lollmsElfServer.audio_cap.start_recording() + except: + lollmsElfServer.InfoMessage("Couldn't load media library.\nYou will not be able to perform any of the media linked operations. please verify the logs and install any required installations") + @sio.on('stop_audio_stream') def stop_audio_stream(sid): diff --git a/lollms_core b/lollms_core index 395b6243..3ecb4cfc 160000 --- a/lollms_core +++ b/lollms_core @@ -1 +1 @@ -Subproject commit 395b6243ba2bc6aa962c9eb9ceb7385921d9bb83 +Subproject commit 3ecb4cfcf0d22eacef551d741ded6b7efcb57ff8 diff --git a/lollms_webui.py b/lollms_webui.py index fbb811c5..98f27105 100644 --- a/lollms_webui.py +++ b/lollms_webui.py @@ -26,12 +26,7 @@ from lollms.generation import RECPTION_MANAGER, ROLE_CHANGE_DECISION, ROLE_CHANG import git import asyncio import os -try: - from lollms.media import WebcamImageSender, AudioRecorder - Media_on=True -except: - ASCIIColors.warning("Couldn't load media library.\nYou will not be able to perform any of the media linked operations. please verify the logs and install any required installations") - Media_on=False + from safe_store import TextVectorizer, VectorizationMethod, VisualizationMethod import threading @@ -205,24 +200,6 @@ class LOLLMSWebUI(LOLLMSElfServer): "reception_manager": RECPTION_MANAGER() } } - if Media_on: - try: - self.webcam = WebcamImageSender(sio,lollmsCom=self) - except: - self.webcam = None - try: - self.rec_output_folder = lollms_paths.personal_outputs_path/"audio_rec" - self.rec_output_folder.mkdir(exist_ok=True, parents=True) - self.summoned = False - self.audio_cap = AudioRecorder(sio,self.rec_output_folder/"rt.wav", callback=self.audio_callback,lollmsCom=self) - except: - self.audio_cap = None - self.rec_output_folder = None - else: - self.webcam = None - self.rec_output_folder = None - - # Define a WebSocket event handler @sio.event