import gradio as gr from helper_function import speech_to_speech_translation from pathlib import Path examples = list(Path('').rglob('*mp3')) examples.sort() demo = gr.Blocks() title = 'Audio translator 🇧🇷 ➡️ 🇺🇸' description = 'A stacked aproach for translating audios from Portuguese to English' translate = gr.Interface( fn=speech_to_speech_translation, inputs=gr.Audio(label='Input', sources=['upload', 'microphone'], type='filepath'), outputs=[gr.Audio(label='Output', type='numpy'), gr.Textbox(label="Tradução")], flagging_mode='never', examples=examples, title=title, description=description ) translate.launch()