From 9586b5c22905a8aa6267e013a491a66593b2bf4a Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 29 Jan 2024 19:48:29 +0100 Subject: [PATCH] upgraded lollms --- lollms/app.py | 2 +- lollms/services/xtts/log.txt | 0 lollms/services/xtts/lollms_xtts.py | 20 ++++++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 lollms/services/xtts/log.txt diff --git a/lollms/app.py b/lollms/app.py index 2d40110..bc82f83 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -71,7 +71,7 @@ class LollmsApplication(LoLLMsCom): if self.config.enable_voice_service and load_voice_service: try: from lollms.services.xtts.lollms_xtts import LollmsXTTS - self.tts = LollmsXTTS(self, voice_samples_path=lollms_paths.custom_voices_path, xtts_base_url=self.config.xtts_base_url) + self.tts = LollmsXTTS(self, voice_samples_path=lollms_paths.custom_voices_path, xtts_base_url=self.config.xtts_base_url, wait_for_service=False) except: self.warning(f"Couldn't load XTTS") diff --git a/lollms/services/xtts/log.txt b/lollms/services/xtts/log.txt new file mode 100644 index 0000000..e69de29 diff --git a/lollms/services/xtts/lollms_xtts.py b/lollms/services/xtts/lollms_xtts.py index 0e6235f..f862efe 100644 --- a/lollms/services/xtts/lollms_xtts.py +++ b/lollms/services/xtts/lollms_xtts.py @@ -51,9 +51,13 @@ def install_xtts(lollms_app:LollmsApplication): if platform.system() == 'Windows': - os.system(f'{Path(__file__).parent}/xtts_installer.bat') + xtts_installer = f'{Path(__file__).parent}/xtts_installer.bat' + cwd = Path(os.path.realpath(sys.argv[0])).parent.parent + subprocess.Popen(xtts_installer, cwd=cwd, shell=True) elif platform.system() == 'Linux' or platform.system() == 'Darwin': - os.system(f'{Path(__file__).parent}/xtts_installer.sh') + xtts_installer = f'{Path(__file__).parent}/xtts_installer.sh' + cwd = Path(os.path.realpath(sys.argv[0])).parent.parent + subprocess.Popen(xtts_installer, cwd=cwd, shell=True) else: print("Unsupported operating system.") @@ -84,7 +88,8 @@ class LollmsXTTS: xtts_base_url=None, share=False, max_retries=10, - voice_samples_path="" + voice_samples_path="", + wait_for_service=True ): if xtts_base_url=="" or xtts_base_url=="http://127.0.0.1:8020": xtts_base_url = None @@ -123,9 +128,11 @@ class LollmsXTTS: # Launch the Flask service using the appropriate script for the platform if platform.system() == 'Windows': + xtts_runner = f'{Path(__file__).parent}/xtts_run.bat {self.output_folder} {self.voice_samples_path}' + cwd = Path(os.path.realpath(sys.argv[0])).parent.parent ASCIIColors.info("Running on windows") - subprocess.Popen(f'{Path(__file__).parent}/xtts_run.bat {self.output_folder} {self.voice_samples_path}', cwd=Path(__file__).parent) - os.system() + ASCIIColors.info(f"Starting : {xtts_runner} from {cwd}") + subprocess.Popen(xtts_runner, cwd=cwd, shell=True) elif platform.system() == 'Linux' or platform.system() == 'Darwin': ASCIIColors.info("Running on Linux/macos") subprocess.Popen(f'{Path(__file__).parent}/xtts_run.sh {self.output_folder} {self.voice_samples_path}', cwd=Path(__file__).parent) @@ -135,7 +142,8 @@ class LollmsXTTS: # subprocess.Popen(["python", "-m", "xtts_api_server", "-o", f"{self.output_folder}", "-sf", f"{self.voice_samples_path}"]) # Wait until the service is available at http://127.0.0.1:7860/ - self.wait_for_service(max_retries=max_retries) + if wait_for_service: + self.wait_for_service(max_retries=max_retries) def wait_for_service(self, max_retries = 150, show_warning=True):