import gradio as gr from googletrans import Translator translator = Translator() def translate_text(text): translation = translator.translate(text, dest="en") return translation.text gradio_interface = gr.Interface( fn=translate_text, inputs="text", outputs="text", title="Google Translate", description="Translate text using Google Translate API", theme="default" ) gradio_interface.launch()