Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,6 @@ Demo for text-to-speech translation in French. Demo uses [gitgato/trtts](https:/
|
|
35 |
![Text-to-Speech (TTS)"](https://geekflare.com/wp-content/uploads/2021/07/texttospeech-1200x385.png "Diagram of Text-to-Speech (TTS)")
|
36 |
"""
|
37 |
|
38 |
-
|
39 |
def cleanup_text(text):
|
40 |
for src, dst in replacements:
|
41 |
text = text.replace(src, dst)
|
@@ -47,13 +46,18 @@ def synthesize_speech(text):
|
|
47 |
|
48 |
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
49 |
|
50 |
-
|
|
|
51 |
|
|
|
52 |
syntesize_speech_gradio = gr.Interface(
|
53 |
synthesize_speech,
|
54 |
-
inputs
|
55 |
-
outputs=gr.Audio(),
|
56 |
examples=["Je n'entrerai pas dans les détails, mais je profiterai des secondes qui me restent pour exposer la position ALDE sur le marquage CE, un des points cruciaux de ce rapport."],
|
57 |
title=title,
|
58 |
description=description,
|
59 |
-
)
|
|
|
|
|
|
|
|
35 |
![Text-to-Speech (TTS)"](https://geekflare.com/wp-content/uploads/2021/07/texttospeech-1200x385.png "Diagram of Text-to-Speech (TTS)")
|
36 |
"""
|
37 |
|
|
|
38 |
def cleanup_text(text):
|
39 |
for src, dst in replacements:
|
40 |
text = text.replace(src, dst)
|
|
|
46 |
|
47 |
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
48 |
|
49 |
+
# Crear el objeto gr.Audio directamente con los parámetros necesarios
|
50 |
+
return gr.Audio((16000, speech.cpu().numpy()))
|
51 |
|
52 |
+
# Definir la interfaz de Gradio
|
53 |
syntesize_speech_gradio = gr.Interface(
|
54 |
synthesize_speech,
|
55 |
+
inputs=gr.Textbox(label="Text", placeholder="Type something here..."),
|
56 |
+
outputs=gr.Audio(label="Speech"),
|
57 |
examples=["Je n'entrerai pas dans les détails, mais je profiterai des secondes qui me restent pour exposer la position ALDE sur le marquage CE, un des points cruciaux de ce rapport."],
|
58 |
title=title,
|
59 |
description=description,
|
60 |
+
)
|
61 |
+
|
62 |
+
# Lanzar la interfaz
|
63 |
+
syntesize_speech_gradio.launch()
|