Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,30 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
|
| 5 |
+
def trnslt(text,lnguage):
|
| 6 |
+
txt_inp = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tl-en")
|
| 7 |
+
if lnguage=="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 lnguage=="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 lnguage=="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)
|
| 19 |
|
| 20 |
+
iface = gr.Interface(
|
| 21 |
+
fn=trnslt,
|
| 22 |
+
[inputs='text',gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"])],
|
| 23 |
+
outputs='text',
|
| 24 |
+
examples=[["Magandang Umaga"],["Magandang gabi"],["Masarap ang Adobo"],["Kumusta Ka Na"],["Magandang umaga"]],
|
| 25 |
+
theme="darkpeach",
|
| 26 |
+
css=".footer{display:none !important}",
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
iface.launch()
|
| 30 |
|
| 31 |
|