Duha commited on
Commit
84c9807
1 Parent(s): 9f42315

Create app.py

Browse files
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
+ mdl_name = "Helsinki-NLP/opus-mt-en-ar"
4
+ opus_translator = pipeline("translation", model=mdl_name)
5
+ def translate(text):
6
+ response = opus_translator(text)
7
+ return response
8
+ grad.Interface(translate, inputs=["text",], outputs="text").
9
+ launch()