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