Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import numpy as np
|
|
5 |
|
6 |
def load_tts_model():
|
7 |
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
8 |
-
"facebook/tts_transformer-zh-cv7_css10",
|
9 |
arg_overrides={"vocoder": "hifigan", "fp16": False}
|
10 |
)
|
11 |
model = models[0]
|
@@ -20,12 +20,21 @@ def synthesize_text(text):
|
|
20 |
wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
|
21 |
return np.array(wav), rate
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
iface = gr.Interface(
|
24 |
fn=synthesize_text,
|
25 |
-
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter
|
26 |
outputs=gr.outputs.Audio(label="Synthesized Speech"),
|
27 |
title="Text to Speech Synthesis",
|
28 |
-
description="A simple text-to-speech app
|
|
|
|
|
29 |
)
|
30 |
|
31 |
-
iface.launch()
|
|
|
5 |
|
6 |
def load_tts_model():
|
7 |
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
8 |
+
"facebook/tts_transformer-zh-cv7_css10", # Considere usar um modelo para inglês
|
9 |
arg_overrides={"vocoder": "hifigan", "fp16": False}
|
10 |
)
|
11 |
model = models[0]
|
|
|
20 |
wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
|
21 |
return np.array(wav), rate
|
22 |
|
23 |
+
# Exemplos pré-carregados em inglês
|
24 |
+
examples = [
|
25 |
+
["Hello, how are you today?"],
|
26 |
+
["What's the weather like?"],
|
27 |
+
["Learning new languages is fun."],
|
28 |
+
# Adicione mais exemplos aqui
|
29 |
+
]
|
30 |
+
|
31 |
iface = gr.Interface(
|
32 |
fn=synthesize_text,
|
33 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter English text here..."),
|
34 |
outputs=gr.outputs.Audio(label="Synthesized Speech"),
|
35 |
title="Text to Speech Synthesis",
|
36 |
+
description="A simple text-to-speech app. Note: The model is trained for Chinese, results may vary for English.",
|
37 |
+
examples=examples,
|
38 |
+
theme="huggingface"
|
39 |
)
|
40 |
|
|