From 3f844932ebc28e541215a27e55e5d1978f5ff5a2 Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Fri, 8 Dec 2023 16:29:59 +0000 Subject: [PATCH] Add files via upload --- script.py | 23 ++++++++--------------- tts_server.py | 14 ++++---------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/script.py b/script.py index bdd9b73..b3f3797 100644 --- a/script.py +++ b/script.py @@ -43,12 +43,10 @@ try: from TTS.utils.synthesizer import Synthesizer except ModuleNotFoundError: logger.error( - "[params['branding']]\033[91mWarning\033[0m Could not find the TTS module. Make sure to install the requirements for the " - + params["branding"] - + " extension." - "[params['branding']]\033[91mWarning\033[0m Linux / Mac:\npip install -r extensions/alltalk_tts/requirements.txt\n" - "[params['branding']]\033[91mWarning\033[0m Windows:\npip install -r extensions\\alltalk_tts\\requirements.txt\n" - "[params['branding']]\033[91mWarning\033[0m If you used the one-click installer, paste the command above in the terminal window launched after running the cmd_ script. On Windows, that's cmd_windows.bat." + f"[{params['branding']}]\033[91mWarning\033[0m Could not find the TTS module. Make sure to install the requirements for the {params['branding']} extension." + f"[{params['branding']}]\033[91mWarning\033[0m Linux / Mac:\npip install -r extensions/alltalk_tts/requirements.txt\n" + f"[{params['branding']}]\033[91mWarning\033[0m Windows:\npip install -r extensions\\alltalk_tts\\requirements.txt\n" + f"[{params['branding']}]\033[91mWarning\033[0m If you used the one-click installer, paste the command above in the terminal window launched after running the cmd_ script. On Windows, that's cmd_windows.bat." ) raise @@ -78,8 +76,8 @@ def get_available_voices(): #### LICENSE DISPLAY #### ######################### # STARTUP Display Licence Information -print("[" + params["branding"] + "Startup] \033[94mCoqui Public Model License\033[0m") -print("[" + params["branding"] + "Startup] \033[94mhttps://coqui.ai/cpml.txt\033[0m") +print(f"[{params['branding']}Startup] \033[94mCoqui Public Model License\033[0m") +print(f"[{params['branding']}Startup] \033[94mhttps://coqui.ai/cpml.txt\033[0m") ############################################ @@ -87,12 +85,7 @@ print("[" + params["branding"] + "Startup] \033[94mhttps://coqui.ai/cpml.txt\033 ############################################ def delete_old_files(folder_path, days_to_keep): current_time = datetime.now() - print( - "[" - + params["branding"] - + "Startup] Deletion of old output folder WAV files is currently enabled and set at", - delete_output_wavs_setting, - ) + print(f"[{params['branding']}Startup] Deletion of old output folder WAV files is currently enabled and set at", delete_output_wavs_setting) for file_name in os.listdir(folder_path): file_path = os.path.join(folder_path, file_name) if os.path.isfile(file_path): @@ -254,7 +247,7 @@ while time.time() - start_time < timeout: except requests.RequestException as e: # Print the exception for debugging purposes print( - f"[{params['branding']}Startup] \033[91mWarning\033[0m TTS Subprocess has NOT started up yet, Will keep trying for 60 seconds maximum" + f"[{params['branding']}Startup] \033[91mWarning\033[0m TTS Subprocess has NOT started up yet, Will keep trying for 60 seconds maximum. Please wait." ) time.sleep(1) else: diff --git a/tts_server.py b/tts_server.py index 3007b2c..52f0609 100644 --- a/tts_server.py +++ b/tts_server.py @@ -101,16 +101,10 @@ try: deepspeed_installed = True print(f"[{params['branding']}Startup] DeepSpeed \033[93mDetected\033[0m") - print( - f"[{params['branding']}Startup] Activate DeepSpeed in " - + params["branding"] - + " settings" - ) + print(f"[{params['branding']}Startup] Activate DeepSpeed in {params['branding']} settings") except ImportError: deepspeed_installed = False - print( - f"[{params['branding']}Startup] DeepSpeed \033[93mNot Detected\033[0m. See https://github.com/microsoft/DeepSpeed" - ) + print(f"[{params['branding']}Startup] DeepSpeed \033[93mNot Detected\033[0m. See https://github.com/microsoft/DeepSpeed") @asynccontextmanager @@ -411,7 +405,7 @@ async def generate_audio(text, voice, language, output_file): generate_start_time = time.time() # Record the start time of generating TTS # XTTSv2 LOCAL Method if params["tts_method_xtts_local"]: - print("[" + params["branding"] + "TTSGen] {}".format(text)) + print(f"[{params['branding']}TTSGen] {text}") gpt_cond_latent, speaker_embedding = model.get_conditioning_latents( audio_path=[f"{this_dir}/voices/{voice}"] ) @@ -427,7 +421,7 @@ async def generate_audio(text, voice, language, output_file): # API TTS and API LOCAL Methods elif params["tts_method_api_tts"] or params["tts_method_api_local"]: # Set the correct output path (different from the if statement) - print("[" + params["branding"] + "TTSGen] Using API TTS/Local Method") + print(f"[{params['branding']}TTSGen] Using API TTS/Local Method") model.tts_to_file( text=text, file_path=output_file,