Spaces:
Runtime error
Runtime error
Commit
•
a677c4a
1
Parent(s):
b069b22
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,9 @@ from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
|
|
2 |
from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
|
3 |
import IPython.display as ipd
|
4 |
import gradio as gr
|
|
|
|
|
|
|
5 |
|
6 |
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
7 |
"facebook/tts_transformer-tr-cv7",
|
@@ -12,13 +15,13 @@ TTSHubInterface.update_cfg_with_data_cfg(cfg, task.data_cfg)
|
|
12 |
generator = task.build_generator([model], cfg)
|
13 |
|
14 |
def tts(text):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
iface = gr.Interface(fn=greet, inputs=gr.inputs.Textbox(placeholder="Lütfen Cümle Giriniz...", lines=5), outputs=outputs)
|
24 |
-
iface.launch(share=True)
|
|
|
2 |
from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
|
3 |
import IPython.display as ipd
|
4 |
import gradio as gr
|
5 |
+
import tempfile
|
6 |
+
import gradio as gr
|
7 |
+
import soundfile as sf
|
8 |
|
9 |
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
10 |
"facebook/tts_transformer-tr-cv7",
|
|
|
15 |
generator = task.build_generator([model], cfg)
|
16 |
|
17 |
def tts(text):
|
18 |
+
sample = TTSHubInterface.get_model_input(task, text)
|
19 |
+
wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
|
20 |
+
sf.write('./audio_after.wav', wav, rate, "PCM_16")
|
21 |
+
return './audio_after.wav'
|
22 |
+
|
23 |
+
outputs = gr.Audio(type="filepath", label="Output Audio")
|
24 |
+
|
25 |
+
demo = gr.Interface(fn=tts, inputs=gr.inputs.Textbox(placeholder="Lütfen Cümle Giriniz...", lines=5), outputs=outputs)
|
26 |
|
27 |
+
demo.launch()
|
|
|
|