File size: 968 Bytes
1c0dfed
 
 
54a8795
75ab782
 
 
 
 
 
 
 
 
 
 
 
 
 
aab3008
75ab782
 
c1410e2
 
75ab782
 
 
 
 
 
 
1c0dfed
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
from transformers import pipeline


def trnslt(text,lnguage):
  txt_inp = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tl-en")
  if lnguage=="Cebuano":
    ceb1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ceb")
    out_ceb = gr.Series(txt_inp,ceb1)
    return out_ceb(text)
  elif lnguage=="Ilocano":
    ilo1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ilo")
    out_ilo = gr.Series(txt_inp,ilo1)
    return out_ilo(text)
  elif lnguage=="Hiligaynon":
    hil1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-hil")
    out_hil = gr.Series(txt_inp,hil1)
    return out_hil(text)

iface = gr.Interface(
  fn=trnslt, 
  inputs=["text",
  gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"]),],
  outputs='text',
  examples=[["Magandang Umaga"],["Magandang gabi"],["Masarap ang Adobo"],["Kumusta Ka Na"],["Magandang umaga"]],
  theme="darkpeach",
  css=".footer{display:none !important}", 
)

iface.launch()