File size: 1,226 Bytes
eea7488
 
2e47242
eea7488
d7d2bcc
eea7488
2e47242
eea7488
d727a02
9e85c7e
 
d727a02
 
d7d2bcc
 
d727a02
 
 
 
 
d7d2bcc
d727a02
 
 
 
 
 
 
d7d2bcc
 
d727a02
 
 
 
d7d2bcc
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
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)