Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def gpu_decorator(func):
|
|
| 32 |
return func
|
| 33 |
|
| 34 |
device = (
|
| 35 |
-
"
|
| 36 |
if torch.cuda.is_available()
|
| 37 |
else "mps" if torch.backends.mps.is_available() else "cpu"
|
| 38 |
)
|
|
@@ -92,7 +92,10 @@ F5TTS_model_cfg = dict(
|
|
| 92 |
E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4)
|
| 93 |
|
| 94 |
F5TTS_ema_model = load_model(
|
| 95 |
-
"Gregniuki", "F5-tts_English_German_Polish", "
|
|
|
|
|
|
|
|
|
|
| 96 |
)
|
| 97 |
#E2TTS_ema_model = load_model(
|
| 98 |
# "SWivid", "F5-TTS", "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000
|
|
@@ -129,9 +132,9 @@ def chunk_text(text, max_chars=135):
|
|
| 129 |
|
| 130 |
@gpu_decorator
|
| 131 |
def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence, cross_fade_duration=0.15, progress=gr.Progress()):
|
| 132 |
-
if exp_name == "
|
| 133 |
ema_model = F5TTS_ema_model
|
| 134 |
-
elif exp_name == "
|
| 135 |
ema_model = E2TTS_ema_model
|
| 136 |
|
| 137 |
audio, sr = ref_audio
|
|
@@ -390,7 +393,7 @@ with gr.Blocks() as app_tts:
|
|
| 390 |
ref_audio_input = gr.Audio(label="Reference Audio", type="filepath")
|
| 391 |
gen_text_input = gr.Textbox(label="Text to Generate", lines=10)
|
| 392 |
model_choice = gr.Radio(
|
| 393 |
-
choices=["
|
| 394 |
)
|
| 395 |
generate_btn = gr.Button("Synthesize", variant="primary")
|
| 396 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
| 32 |
return func
|
| 33 |
|
| 34 |
device = (
|
| 35 |
+
"gpu"
|
| 36 |
if torch.cuda.is_available()
|
| 37 |
else "mps" if torch.backends.mps.is_available() else "cpu"
|
| 38 |
)
|
|
|
|
| 92 |
E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4)
|
| 93 |
|
| 94 |
F5TTS_ema_model = load_model(
|
| 95 |
+
"Gregniuki", "F5-tts_English_German_Polish", "English", DiT, F5TTS_model_cfg, 222600
|
| 96 |
+
)
|
| 97 |
+
E2TTS_ema_model = load_model(
|
| 98 |
+
"Gregniuki", "F5-tts_English_German_Polish", "Polish2", DiT, F5TTS_model_cfg, 1200000
|
| 99 |
)
|
| 100 |
#E2TTS_ema_model = load_model(
|
| 101 |
# "SWivid", "F5-TTS", "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000
|
|
|
|
| 132 |
|
| 133 |
@gpu_decorator
|
| 134 |
def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence, cross_fade_duration=0.15, progress=gr.Progress()):
|
| 135 |
+
if exp_name == "English":
|
| 136 |
ema_model = F5TTS_ema_model
|
| 137 |
+
elif exp_name == "Polish":
|
| 138 |
ema_model = E2TTS_ema_model
|
| 139 |
|
| 140 |
audio, sr = ref_audio
|
|
|
|
| 393 |
ref_audio_input = gr.Audio(label="Reference Audio", type="filepath")
|
| 394 |
gen_text_input = gr.Textbox(label="Text to Generate", lines=10)
|
| 395 |
model_choice = gr.Radio(
|
| 396 |
+
choices=["English","Polish"], label="Choose TTS Model", value="English"
|
| 397 |
)
|
| 398 |
generate_btn = gr.Button("Synthesize", variant="primary")
|
| 399 |
with gr.Accordion("Advanced Settings", open=False):
|