Spaces:
Sleeping
Sleeping
File size: 570 Bytes
7fa0d3d 8ab7dc3 7fa0d3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import pipeline
import gradio as gr
language_translation_ckpt = f"Helsinki-NLP/opus-mt-nl-en"
translator = pipeline("translation", model=language_translation_ckpt)
def translate_nl_en(text):
translation = translator(text)
translation = translation[0]['translation_text']
return translation
with gr.Blocks() as demo:
nl_text = gr.Textbox(label="NL")
en_text = gr.Textbox(label="EN")
translate_button = gr.Button("Vertaal")
translate_button.click(translate_nl_en, inputs=nl_text, outputs=en_text, api_name=translate_nl_en)
demo.launch() |