Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
# Instalar dependencias
|
| 2 |
-
os.system("pip install TTS gradio torchaudio")
|
| 3 |
|
| 4 |
-
import gradio as gr
|
| 5 |
-
import torchaudio
|
| 6 |
-
from TTS.api import TTS
|
| 7 |
import os
|
| 8 |
|
|
|
|
|
|
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Cargar el modelo Coqui XTTS v2.0.3
|
| 12 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2.0.3", gpu=False)
|
|
@@ -16,13 +16,14 @@ def text_to_speech(text):
|
|
| 16 |
tts.tts_to_file(text=text, file_path=output_path)
|
| 17 |
return output_path
|
| 18 |
|
| 19 |
-
# Interfaz con
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
inputs=gr.Textbox(label="Ingrese el texto"),
|
| 23 |
-
outputs=gr.Audio(label="Audio generado"),
|
| 24 |
-
title="Conversión de Texto a Voz con Coqui XTTS v2.0.3",
|
| 25 |
-
description="Ingrese un texto y escuche el audio generado utilizando el modelo XTTS v2.0.3 de Coqui."
|
| 26 |
-
)
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
+
# Instalar dependencias
|
| 5 |
+
os.system("pip install TTS torchaudio")
|
| 6 |
|
| 7 |
+
import streamlit as st
|
| 8 |
+
import torchaudio
|
| 9 |
+
from TTS.api import TTS
|
| 10 |
|
| 11 |
# Cargar el modelo Coqui XTTS v2.0.3
|
| 12 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2.0.3", gpu=False)
|
|
|
|
| 16 |
tts.tts_to_file(text=text, file_path=output_path)
|
| 17 |
return output_path
|
| 18 |
|
| 19 |
+
# Interfaz con Streamlit
|
| 20 |
+
st.title("Conversión de Texto a Voz con Coqui XTTS v2.0.3")
|
| 21 |
+
st.write("Ingrese un texto y escuche el audio generado utilizando el modelo XTTS v2.0.3 de Coqui.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
text = st.text_area("Ingrese el texto")
|
| 24 |
+
if st.button("Generar Audio"):
|
| 25 |
+
if text:
|
| 26 |
+
output_audio = text_to_speech(text)
|
| 27 |
+
st.audio(output_audio, format="audio/wav")
|
| 28 |
+
else:
|
| 29 |
+
st.warning("Por favor, ingrese un texto antes de generar el audio.")
|