Spaces:
Runtime error
Runtime error
File size: 538 Bytes
073e9ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |