Spaces:
Sleeping
Sleeping
Create new file
Browse files
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()
|