Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,17 +2,17 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
|
5 |
-
def trnslt(text,
|
6 |
txt_inp = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tl-en")
|
7 |
-
if
|
8 |
ceb1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ceb")
|
9 |
out_ceb = gr.Series(txt_inp,ceb1)
|
10 |
return out_ceb(text)
|
11 |
-
elif
|
12 |
ilo1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ilo")
|
13 |
out_ilo = gr.Series(txt_inp,ilo1)
|
14 |
return out_ilo(text)
|
15 |
-
elif
|
16 |
hil1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-hil")
|
17 |
out_hil = gr.Series(txt_inp,hil1)
|
18 |
return out_hil(text)
|
@@ -20,9 +20,9 @@ def trnslt(text,lnguage):
|
|
20 |
iface = gr.Interface(
|
21 |
fn=trnslt,
|
22 |
inputs=["text",
|
23 |
-
gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"])
|
24 |
outputs='text',
|
25 |
-
examples=[["Magandang Umaga"],["Magandang gabi"],["Masarap ang Adobo"],["Kumusta Ka Na"],["Magandang umaga"]],
|
26 |
theme="darkpeach",
|
27 |
css=".footer{display:none !important}",
|
28 |
)
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
|
5 |
+
def trnslt(text,Language):
|
6 |
txt_inp = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tl-en")
|
7 |
+
if Language=="Cebuano":
|
8 |
ceb1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ceb")
|
9 |
out_ceb = gr.Series(txt_inp,ceb1)
|
10 |
return out_ceb(text)
|
11 |
+
elif Language=="Ilocano":
|
12 |
ilo1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ilo")
|
13 |
out_ilo = gr.Series(txt_inp,ilo1)
|
14 |
return out_ilo(text)
|
15 |
+
elif Language=="Hiligaynon":
|
16 |
hil1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-hil")
|
17 |
out_hil = gr.Series(txt_inp,hil1)
|
18 |
return out_hil(text)
|
|
|
20 |
iface = gr.Interface(
|
21 |
fn=trnslt,
|
22 |
inputs=["text",
|
23 |
+
gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"],label="Translate to",optional=False)],
|
24 |
outputs='text',
|
25 |
+
examples=[["Magandang Umaga"],["Magandang gabi"],["Masarap ang Adobo"],["Kumusta Ka Na"],["Bumibili si Juan ng manok",["Magandang umaga"]],
|
26 |
theme="darkpeach",
|
27 |
css=".footer{display:none !important}",
|
28 |
)
|