mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-08 03:50:22 +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")
|
lollmsElfServer.info("Starting to build voice")
|
||||||
try:
|
try:
|
||||||
from lollms.services.xtts.lollms_xtts import LollmsXTTS
|
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:
|
if lollmsElfServer.tts is None:
|
||||||
lollmsElfServer.tts = LollmsXTTS(
|
lollmsElfServer.tts = LollmsXTTS(
|
||||||
lollmsElfServer,
|
lollmsElfServer,
|
||||||
|
voices_folder=voices_folder,
|
||||||
voice_samples_path=Path(__file__).parent/"voices",
|
voice_samples_path=Path(__file__).parent/"voices",
|
||||||
xtts_base_url= lollmsElfServer.config.xtts_base_url,
|
xtts_base_url= lollmsElfServer.config.xtts_base_url,
|
||||||
use_deep_speed=lollmsElfServer.config.xtts_use_deepspeed,
|
use_deep_speed=lollmsElfServer.config.xtts_use_deepspeed,
|
||||||
@ -124,10 +129,6 @@ async def text2Audio(request: LollmsText2AudioRequest):
|
|||||||
)
|
)
|
||||||
if lollmsElfServer.tts.ready:
|
if lollmsElfServer.tts.ready:
|
||||||
language = lollmsElfServer.config.xtts_current_language# convert_language_name()
|
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)
|
lollmsElfServer.tts.set_speaker_folder(voices_folder)
|
||||||
url = f"audio/{output_fn}"
|
url = f"audio/{output_fn}"
|
||||||
preprocessed_text= add_period(request.text)
|
preprocessed_text= add_period(request.text)
|
||||||
|
@ -110,12 +110,13 @@ class LollmsXTTS:
|
|||||||
xtts_base_url=None,
|
xtts_base_url=None,
|
||||||
share=False,
|
share=False,
|
||||||
max_retries=20,
|
max_retries=20,
|
||||||
|
voices_folder=None,
|
||||||
voice_samples_path="",
|
voice_samples_path="",
|
||||||
wait_for_service=True,
|
wait_for_service=True,
|
||||||
use_deep_speed=False,
|
use_deep_speed=False,
|
||||||
use_streaming_mode = True
|
use_streaming_mode = True
|
||||||
|
):
|
||||||
):
|
self.voices_folder = voices_folder
|
||||||
self.ready = False
|
self.ready = False
|
||||||
if xtts_base_url=="" or xtts_base_url=="http://127.0.0.1:8020":
|
if xtts_base_url=="" or xtts_base_url=="http://127.0.0.1:8020":
|
||||||
xtts_base_url = None
|
xtts_base_url = None
|
||||||
@ -159,7 +160,8 @@ class LollmsXTTS:
|
|||||||
self.process = self.run_xtts_api_server()
|
self.process = self.run_xtts_api_server()
|
||||||
|
|
||||||
# Wait until the service is available at http://127.0.0.1:7860/
|
# 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):
|
def run_xtts_api_server(self):
|
||||||
@ -191,7 +193,8 @@ class LollmsXTTS:
|
|||||||
print("Service is available.")
|
print("Service is available.")
|
||||||
if self.app is not None:
|
if self.app is not None:
|
||||||
self.app.success("XTTS Service is now available.")
|
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
|
self.ready = True
|
||||||
return True
|
return True
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user