gabrielabueg commited on
Commit
d7d2bcc
·
1 Parent(s): 95b66d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
 
3
  title = "Tagalog RoBERTa"
4
 
5
- description = "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."
6
 
7
  article = "Improving Large-scale Language Models and Resources for Filipino,Jan Christian Blaise Cruz and Charibeth Cheng,arXiv preprint arXiv:2111.06053,2021"
8
 
@@ -10,13 +10,14 @@ examples = [
10
  ['Ang alaga ni Biboy ay <mask>.','roberta-']
11
  ]
12
 
13
- io1 = gr.Interface.load("huggingface/roberta-base")
 
14
 
15
  io2 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-large")
16
 
17
 
18
  def inference(inputtext, model):
19
- if model == "roberta-base":
20
  outlabel = io1(inputtext)
21
  else:
22
  outlabel = io2(inputtext)
@@ -24,10 +25,10 @@ def inference(inputtext, model):
24
 
25
 
26
  gr.Interface(
27
- gr.Interface.load("huggingface/jcblaise/roberta-tagalog-large"),
28
- [gr.inputs.Textbox(label="Input Text",lines=10)],
29
  [gr.outputs.Label(label="Output")],
30
  examples=examples,
31
  article=article,
32
  title=title,
33
- description=description).launch(enable_queue=True)
 
2
 
3
  title = "Tagalog RoBERTa"
4
 
5
+ 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>"
6
 
7
  article = "Improving Large-scale Language Models and Resources for Filipino,Jan Christian Blaise Cruz and Charibeth Cheng,arXiv preprint arXiv:2111.06053,2021"
8
 
 
10
  ['Ang alaga ni Biboy ay <mask>.','roberta-']
11
  ]
12
 
13
+
14
+ io1 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-base")
15
 
16
  io2 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-large")
17
 
18
 
19
  def inference(inputtext, model):
20
+ if model == "roberta-tagalog-base":
21
  outlabel = io1(inputtext)
22
  else:
23
  outlabel = io2(inputtext)
 
25
 
26
 
27
  gr.Interface(
28
+ inference,
29
+ [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")],
30
  [gr.outputs.Label(label="Output")],
31
  examples=examples,
32
  article=article,
33
  title=title,
34
+ description=description).launch(enable_queue=True)