File size: 500 Bytes
75f67b4
 
 
 
 
 
 
01a6864
 
75f67b4
01a6864
 
 
 
1033da7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr

from transformers import pipeline

translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-fr")

def translate_sentence(input_text):
  for value in translator(input_text)[0].values():
      return value
    
iface = gr.Interface(fn = translate_sentence, inputs = 'text', outputs = 'text',
                     title = "Traduction EN-FR", 
                     description="Un mini google translate avec huggingface")
                     
iface.launch(inline = False)