Spaces:
Runtime error
Runtime error
File size: 1,393 Bytes
1c0dfed 54a8795 8f888d7 75ab782 e4c5728 75ab782 8f888d7 e4c5728 75ab782 8f888d7 e4c5728 75ab782 8f888d7 aab3008 75ab782 6926eb8 e4c5728 75ab782 73bbaa6 8602c1b 8f98fed 760f94e fc40acc 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 34 35 36 37 |
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=[gr.inputs.Textbox(label="Input Tagalog Text"),
gr.inputs.Radio(["Cebuano","Ilocano","Hiligaynon"],label="Translate to",optional=False)],
outputs='text',
examples=[["Magandang Umaga","Cebuano"],["Magandang gabi","Ilocano"],["Masarap ang Adobo","Hiligaynon"],
["Kumusta Ka Na","Cebuano"],["Bumibili si Juan ng manok","Ilocano"],["Magandang umaga","Hiligaynon"]],
live=True,
theme="dark-seafoam",
title="Basic Filipino Dialect Translator",
description=" This application uses Helsinki-NLP models to translate Tagalog texts to 3 other dialects of the Filipino language",
css=".footer{display:none !important}",
)
iface.launch()
|