Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,27 @@ description = "Gradio Demo for DistilBERT. To use it, simply add your text, or c
|
|
7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1910.01108' target='_blank'>DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter</a></p>"
|
8 |
|
9 |
examples = [
|
10 |
-
['The goal of life is [MASK].']
|
11 |
]
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1910.01108' target='_blank'>DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter</a></p>"
|
8 |
|
9 |
examples = [
|
10 |
+
['The goal of life is [MASK].','distilbert-base-uncased']
|
11 |
]
|
12 |
|
13 |
+
|
14 |
+
io1 = gr.Interface.load("huggingface/distilbert-base-uncased")
|
15 |
+
|
16 |
+
io2 = gr.Interface.load("huggingface/distilbert-base-multilingual-cased")
|
17 |
+
|
18 |
+
def inference(inputtext, model):
|
19 |
+
if model == "distilbert-base-uncased":
|
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=["distilbert-base-uncased","distilbert-base-multilingual-cased"], type="value", default="distilbert-base-uncased", label="model")],
|
29 |
+
[gr.outputs.Label(label="Output")],
|
30 |
+
examples=examples,
|
31 |
+
article=article,
|
32 |
+
title=title,
|
33 |
+
description=description).launch(enable_queue=True)
|