import transformers from transformers import pipeline import gradio as gr translator = pipeline("translation" , model='Helsinki-NLP/opus-mt-fr-en') result = translator('J\'irai à l\'eglise') result[0]['translation_text'] def translate(input): result = translator(input) return result[0]['translation_text'] translation_interface = gr.Interface(fn=translate, inputs='text',outputs='text') translation_interface.launch(share=True)