Spaces:
Runtime error
Runtime error
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() |