import gradio as gr from transformers import pipeline model_checkpoint = "Helsinki-NLP/opus-mt-fr-de" translator = pipeline("translation", model=model_checkpoint) my_input = gr.Textbox(label="Input") my_output = gr.Textbox(label="Translation") def iwwersetz(source_text): translation = translator(source_text) return translation demo=gr.Interface( fn=iwwersetz, inputs=my_input, outputs=my_output ) demo.launch()