import gradio as gr from model import run from languages import language_names example_text = "Now let's make my mum's favourite. So three mars bars into the pan. Then we add the tuna and just stir for a bit, just let the chocolate and fish infuse. A sprinkle of olive oil and some tomato ketchup. Now smell that. Oh boy this is going to be incredible." css = """ body { background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); } .gradio-container { font-family: 'Inter', sans-serif; } textarea { border-radius: 12px !important; font-size: 16px !important; } button { border-radius: 999px !important; font-weight: 600 !important; } """ with gr.Blocks( theme=gr.themes.Soft( primary_hue="indigo", secondary_hue="cyan", neutral_hue="slate" ), css=css ) as app: gr.Markdown( """ # 🌍 Universal Translator Translate texts quickly between multiple languages. Simple and functional. """ ) with gr.Row(): with gr.Column(scale=1): source_language = gr.Dropdown( choices=language_names, value="English", label="Source Language" ) input_text = gr.Textbox( label="Original text", placeholder="Please enter the text...", lines=8, value=example_text ) with gr.Column(scale=1): target_language = gr.Dropdown( choices=language_names, value="Portuguese", label="Target Language" ) output_text = gr.Textbox( label="Translation", lines=8, interactive=False ) translate_btn = gr.Button("Translate ✨") translate_btn.click( run, inputs=[input_text, target_language], outputs=output_text ) if __name__ == "__main__": app.queue(max_size=10).launch(mcp_server=True)