import gradio as gr #Get models #ASR model for input speech speech2text = gr.Interface.load("huggingface/facebook/wav2vec2-base-960h", inputs=gr.inputs.Audio(label="Record Audio File", type="file", source = "microphone")) #translates english to spanish text translator = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-es", outputs=gr.outputs.Textbox(label="English to Spanish Translated Text")) #TTS model for output speech text2speech = gr.Interface.load("huggingface/facebook/tts_transformer-es-css10", outputs=gr.outputs.Audio(label="English to Spanish Translated Audio"), allow_flagging="never") translate = gr.Series(speech2text, translator) #outputs Spanish text translation en2es = gr.Series(translate, text2speech) #outputs Spanish audio ui = gr.Parallel(translate, en2es) #allows transcription of Spanish audio #gradio interface ui.title = "English to Spanish Speech Translator" ui.description = """
The model used for the ASR part of this space is from
The English to Spanish text translator pre-trained model is from
The TTS model used is from