Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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()
|