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) |