| | import streamlit as st |
| | import gradio as gr |
| |
|
| | |
| | translatormodel = gr.Interface.load("models/Helsinki-NLP/opus-mt-es-en") |
| | speechmodel = gr.Interface.load("models/facebook/mms-tts-eng") |
| |
|
| | def translate_and_speak(text): |
| | translation = translatormodel(text)[0] |
| | speech_output = speechmodel(translation, lang="en")[0] |
| | return speech_output |
| |
|
| | st.title("Traductor") |
| | text = st.text_area("Por favor, escriba lo que quiere decir para oírlo en Inglés") |
| |
|
| | if st.button("Escuchar"): |
| | speech_output = translate_and_speak(text) |
| | st.audio(speech_output, format="audio/wav") |