mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-02 17:24:54 +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
|
||||
@@ -1,12 +1,37 @@
|
||||
from .BaseTTSEngine import AbstractTTSEngine
|
||||
from .BaseTTSEngine import BaseTTSEngine
|
||||
import gradio as gr
|
||||
|
||||
class ElevenLabsTTSEngine(AbstractTTSEngine):
|
||||
options = [gr.Radio(["Neutral", "Happy", "Sad"], label="emotion")]
|
||||
class ElevenLabsTTSEngine(BaseTTSEngine):
|
||||
options = [
|
||||
{
|
||||
"type": "dropdown",
|
||||
"label": "Voice",
|
||||
"choices": [
|
||||
"Zofija Kendrick",
|
||||
"Narelle Moon",
|
||||
"Barbora MacLean",
|
||||
"Alexandra Hisakawa",
|
||||
"Alma María",
|
||||
"Rosemary Okafor",
|
||||
"Ige Behringer",
|
||||
"Filip Traverse",
|
||||
"Damjan Chapman",
|
||||
"Wulf Carlevaro",
|
||||
"Aaron Dreschner",
|
||||
"Kumar Dahl",
|
||||
"Eugenio Mataracı",
|
||||
"Ferran Simen",
|
||||
"Xavier Hayasaka",
|
||||
"Luis Moray",
|
||||
"Marcos Rudaski",
|
||||
],
|
||||
}
|
||||
]
|
||||
name = "ElevenLabs"
|
||||
description = "ElevenLabs TTS engine."
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, options: list[list | tuple | str | int | float | bool | None]):
|
||||
self.voice = options[0][0]
|
||||
super().__init__()
|
||||
|
||||
def synthesize(self, text: str, path: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user