eng_to_fr.Tans / app.py
Dochee's picture
Create app.py
073e9ab
raw
history blame
538 Bytes
from transformers import pipeline
import gradio as grad
mdl_name = "Helsinki-NLP/opus-mt-en-fr"
opus_translator = pipeline("translation",
model=mdl_name)
def translate(text):
response = opus_translator(text)
return response
txt=grad.Textbox(lines=1,
label="English",
placeholder="EnglishText here")
out=grad.Textbox(lines=1,
label="French")
grad.Interface(translate,
inputs=txt,
outputs=out).launch()