Tagalog_RoBERTa / app.py
gabrielabueg's picture
added Examples
9e85c7e
raw
history blame
1.23 kB
import gradio as gr
title = "Tagalog RoBERTa"
description = "<p style='text-align: center'>Tagalog Gradio Demo for RoBERTa. To use it, simply add your text, or click one of the examples to load them. Read more at the links below.</p>"
article = "Improving Large-scale Language Models and Resources for Filipino,Jan Christian Blaise Cruz and Charibeth Cheng,arXiv preprint arXiv:2111.06053,2021"
examples = [
['Makulay ang <mask> na suot ni Roberta.','roberta-tagalog-base'],
['Nakakasilaw ang sikat ng <mask>.']
]
io1 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-base")
io2 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-large")
def inference(inputtext, model):
if model == "roberta-tagalog-base":
outlabel = io1(inputtext)
else:
outlabel = io2(inputtext)
return outlabel
gr.Interface(
inference,
[gr.inputs.Textbox(label="Input text",lines=10),gr.inputs.Dropdown(choices=["roberta-tagalog-base","roberta-tagalog-large"], type="value", default="roberta-tagalog-base", label="model")],
[gr.outputs.Label(label="Output")],
examples=examples,
article=article,
title=title,
description=description).launch(enable_queue=True)