Iosif24 commited on
Commit
c776a71
·
1 Parent(s): 248c5f1

Create app.py

Browse files

first app commit

Files changed (1) hide show
  1. app.py +9 -0
app.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as grad
3
+ model_name = "Helsinki-NLP/opus-mt-en-de"
4
+ opus_translator = pipeline("translation", model=model_name)
5
+
6
+ def translate(text):
7
+ response = opus_translator(text)
8
+ return response
9
+ grad.Interface("translate", inputs=["text",], outputs="text").launch()