Spaces:
Runtime error
Runtime error
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, | |
("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() | |