mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-01 08:48:19 +00:00
added some voice
This commit is contained in:
parent
718855cb32
commit
501911c488
@ -114,9 +114,14 @@ async def text2Audio(request: LollmsText2AudioRequest):
|
||||
lollmsElfServer.info("Starting to build voice")
|
||||
try:
|
||||
from lollms.services.xtts.lollms_xtts import LollmsXTTS
|
||||
if voice!="main_voice":
|
||||
voices_folder = lollmsElfServer.lollms_paths.custom_voices_path
|
||||
else:
|
||||
voices_folder = Path(__file__).parent.parent.parent/"services/xtts/voices"
|
||||
if lollmsElfServer.tts is None:
|
||||
lollmsElfServer.tts = LollmsXTTS(
|
||||
lollmsElfServer,
|
||||
voices_folder=voices_folder,
|
||||
voice_samples_path=Path(__file__).parent/"voices",
|
||||
xtts_base_url= lollmsElfServer.config.xtts_base_url,
|
||||
use_deep_speed=lollmsElfServer.config.xtts_use_deepspeed,
|
||||
@ -124,10 +129,6 @@ async def text2Audio(request: LollmsText2AudioRequest):
|
||||
)
|
||||
if lollmsElfServer.tts.ready:
|
||||
language = lollmsElfServer.config.xtts_current_language# convert_language_name()
|
||||
if voice!="main_voice":
|
||||
voices_folder = lollmsElfServer.lollms_paths.custom_voices_path
|
||||
else:
|
||||
voices_folder = Path(__file__).parent.parent.parent/"services/xtts/voices"
|
||||
lollmsElfServer.tts.set_speaker_folder(voices_folder)
|
||||
url = f"audio/{output_fn}"
|
||||
preprocessed_text= add_period(request.text)
|
||||
|
@ -110,12 +110,13 @@ class LollmsXTTS:
|
||||
xtts_base_url=None,
|
||||
share=False,
|
||||
max_retries=20,
|
||||
voices_folder=None,
|
||||
voice_samples_path="",
|
||||
wait_for_service=True,
|
||||
use_deep_speed=False,
|
||||
use_streaming_mode = True
|
||||
|
||||
):
|
||||
):
|
||||
self.voices_folder = voices_folder
|
||||
self.ready = False
|
||||
if xtts_base_url=="" or xtts_base_url=="http://127.0.0.1:8020":
|
||||
xtts_base_url = None
|
||||
@ -159,7 +160,8 @@ class LollmsXTTS:
|
||||
self.process = self.run_xtts_api_server()
|
||||
|
||||
# Wait until the service is available at http://127.0.0.1:7860/
|
||||
self.wait_for_service_in_another_thread(max_retries=max_retries)
|
||||
if wait_for_service:
|
||||
self.wait_for_service_in_another_thread(max_retries=max_retries)
|
||||
|
||||
|
||||
def run_xtts_api_server(self):
|
||||
@ -191,7 +193,8 @@ class LollmsXTTS:
|
||||
print("Service is available.")
|
||||
if self.app is not None:
|
||||
self.app.success("XTTS Service is now available.")
|
||||
self.tts_to_audio("xtts is ready",)
|
||||
voice_file = [v for v in self.voices_folder.iterdir() if v.suffix==".wav"]
|
||||
self.tts_to_audio("xtts is ready",voice_file[0])
|
||||
self.ready = True
|
||||
return True
|
||||
except requests.exceptions.RequestException:
|
||||
|
Loading…
x
Reference in New Issue
Block a user