Spaces:
Sleeping
Sleeping
gabrielabueg
commited on
Commit
•
d727a02
1
Parent(s):
a096f66
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1907.11692'>RoBERTa: A Robustly Optimized BERT Pretraining Approach</a> | <a href='https://github.com/pytorch/fairseq/'>Github Repo</a></p>"
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
title = "RoBERTa"
|
|
|
4 |
|
5 |
+
description = "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 = "<p style='text-align: center'><a href='https://arxiv.org/abs/1907.11692' target='_blank'>RoBERTa: A Robustly Optimized BERT Pretraining Approach</a></p>"
|
8 |
|
9 |
+
examples = [
|
10 |
+
['The goal of life is <mask>.','roberta-base']
|
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)
|
23 |
+
return outlabel
|
24 |
+
|
25 |
+
|
26 |
+
gr.Interface(
|
27 |
+
inference,
|
28 |
+
[gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["roberta-base","roberta-tagalog-large"], type="value", default="roberta-base", label="model")],
|
29 |
+
[gr.outputs.Label(label="Output")],
|
30 |
+
examples=examples,
|
31 |
+
article=article,
|
32 |
+
title=title,
|
33 |
+
description=description).launch(enable_queue=True)
|