Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,20 @@
|
|
| 1 |
from TTS.api import TTS
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from TTS.api import TTS
|
| 2 |
+
|
| 3 |
+
# Cargar el modelo Coqui XTTS v2.0.3
|
| 4 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2.0.3", gpu=False)
|
| 5 |
+
|
| 6 |
+
def text_to_speech(text):
|
| 7 |
+
output_path = "output.wav"
|
| 8 |
+
tts.tts_to_file(text=text, file_path=output_path)
|
| 9 |
+
return output_path
|
| 10 |
+
|
| 11 |
+
# Interfaz con Gradio
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=text_to_speech,
|
| 14 |
+
inputs=gr.Textbox(label="Ingrese el texto"),
|
| 15 |
+
outputs=gr.Audio(label="Audio generado"),
|
| 16 |
+
title="Conversión de Texto a Voz con Coqui XTTS v2.0.3",
|
| 17 |
+
description="Ingrese un texto y escuche el audio generado utilizando el modelo XTTS v2.0.3 de Coqui."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
demo.launch()
|