File size: 557 Bytes
75f67b4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
from transformers import pipeline
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-fr")
def translate_sentence(input_text):
"""Get a sentence in french.
And return his translation in english
"""
for value in translator(input_text)[0].values:
return value
iface = gr.Interface(fn = translate_sentence, inputs = 'text', output = 'text',
title = "Traduction EN-FR",
description = "Un mini google translate avec HuggingFace")
iface.launch(inline = False) |