File size: 435 Bytes
e792481
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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)