File size: 433 Bytes
6ea03d5
 
 
6087a99
6ea03d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

model_checkpoint = "Helsinki-NLP/opus-mt-fr-de"
translator = pipeline("translation", model=model_checkpoint)

my_input = gr.Textbox(label="Input")
my_output = gr.Textbox(label="Translation")

def iwwersetz(source_text):
    translation = translator(source_text)
    return translation

demo=gr.Interface(
   fn=iwwersetz,
   inputs=my_input,
   outputs=my_output
)
demo.launch()