mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-02 09:16:19 +00:00
E
This commit is contained in:
@@ -89,23 +89,31 @@ class CoquiTTSEngine(BaseTTSEngine):
|
||||
"hi", # Hindi
|
||||
]
|
||||
options = [
|
||||
gr.Dropdown(
|
||||
voices, value=voices[0], label="voice", max_choices=1
|
||||
),
|
||||
gr.Dropwdown(
|
||||
languages, value=languages[0], label="language", max_choices=1
|
||||
),
|
||||
{
|
||||
"type": "dropdown",
|
||||
"label": "Voice",
|
||||
"choices": voices,
|
||||
"max": 1,
|
||||
},
|
||||
{
|
||||
"type": "dropdown",
|
||||
"label": "Language",
|
||||
"choices": languages,
|
||||
"max": 1,
|
||||
},
|
||||
]
|
||||
def __init__(self):
|
||||
|
||||
def __init__(self, options: list):
|
||||
super().__init__()
|
||||
|
||||
self.voice = options[0][0]
|
||||
self.language = options[1][0]
|
||||
|
||||
os.environ["COQUI_TOS_AGREED"] = "1"
|
||||
self.tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
self.tts.to(device)
|
||||
|
||||
def synthesize(self, text: str, path: str) -> str:
|
||||
voice = self.options[0].value
|
||||
language = self.options[1].value
|
||||
self.tts.tts_to_file(text=text, file_path=path, lang=language, speaker=voice)
|
||||
self.tts.tts_to_file(text=text, file_path=path, lang=self.language, speaker=self.voice)
|
||||
return path
|
||||
Reference in New Issue
Block a user