mbarnig commited on
Commit
6ea03d5
Β·
1 Parent(s): 14adfc2

Create new file

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ model_checkpoint = "Helsinki-NLP/opus-mt-fr-de"
5
+ translator = pipeline("translation", model=model_checkpoint)
6
+
7
+ my_input = gr.Textbox(label="Input")
8
+ my_output = gr.Textbox(label="Translation")
9
+
10
+ def iwwersetz(source_text):
11
+ translation = translator(source_text)
12
+ return translation
13
+
14
+ demo=gr.Interface(
15
+ fn=iwwersetz,
16
+ inputs=my_input,
17
+ outputs=my_output
18
+ )
19
+ demo.launch()