BrianL's picture
Update app.py
8f98fed
raw
history blame
1.29 kB
import gradio as gr
from transformers import pipeline
def trnslt(TagalogText,Language):
txt_inp = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tl-en")
if Language=="Cebuano":
ceb1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ceb")
out_ceb = gr.Series(txt_inp,ceb1)
return out_ceb(TagalogText)
elif Language=="Ilocano":
ilo1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-ilo")
out_ilo = gr.Series(txt_inp,ilo1)
return out_ilo(TagalogText)
elif Language=="Hiligaynon":
hil1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-hil")
out_hil = gr.Series(txt_inp,hil1)
return out_hil(TagalogText)
iface = gr.Interface(
fn=trnslt,
inputs=["text",
gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"],label="Translate to",optional=False)],
outputs='text',
examples=[["Magandang Umaga"],["Magandang gabi"],["Masarap ang Adobo"],["Kumusta Ka Na"],["Bumibili si Juan ng manok"],["Magandang umaga"]],
live=True,
theme="dark-seafoam",
title="Basic Filipino Dialect Translator",
description=" This application uses Helsinki-NLP models models to translate native Tagalog texts to 3 dialects of the Filipino language",
css=".footer{display:none !important}",
)
iface.launch()