Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
translator = pipeline("text2text-generation", model="joortif/helsinki-eng-eus-translation")
|
5 |
+
|
6 |
+
def translate_text(text):
|
7 |
+
result = translator(text, max_length=128)[0]["generated_text"]
|
8 |
+
return result
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=translate_text,
|
12 |
+
inputs=gr.Textbox(lines=4, label="English Input"),
|
13 |
+
outputs=gr.Textbox(label="Euskera Translation"),
|
14 |
+
title="English To Euskera Translator",
|
15 |
+
)
|
16 |
+
|
17 |
+
demo.launch()
|