Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,8 @@ title = "SteelBERT"
|
|
4 |
|
5 |
description = "Gradio Demo for SteelBERT. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
|
6 |
|
7 |
-
|
8 |
examples = [
|
9 |
-
['Paris is the [MASK] of France.','
|
10 |
["A composite steel plate for marine construction was fabricated using 316L stainless steel.", 'SteelBERT'],
|
11 |
["The use of composite [MASK] in construction is growing rapidly.", 'SteelBERT'],
|
12 |
["Advances in [MASK] science are leading to stronger and more durable steel products.", 'SteelBERT'],
|
@@ -15,24 +14,25 @@ examples = [
|
|
15 |
["Nano-engineered [MASK] have the potential to revolutionize the steel industry with their superior properties.", 'SteelBERT']
|
16 |
]
|
17 |
|
18 |
-
|
19 |
io1 = gr.Interface.load("huggingface/SteelBERT")
|
20 |
-
|
21 |
io2 = gr.Interface.load("huggingface/bert-base-uncased")
|
22 |
|
23 |
-
|
24 |
def inference(inputtext, model):
|
25 |
if model == "SteelBERT":
|
26 |
outlabel = io1(inputtext)
|
27 |
else:
|
28 |
outlabel = io2(inputtext)
|
29 |
return outlabel
|
30 |
-
|
31 |
|
32 |
gr.Interface(
|
33 |
-
inference,
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
36 |
examples=examples,
|
37 |
title=title,
|
38 |
-
description=description
|
|
|
|
4 |
|
5 |
description = "Gradio Demo for SteelBERT. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
|
6 |
|
|
|
7 |
examples = [
|
8 |
+
['Paris is the [MASK] of France.', 'SteelBERT'],
|
9 |
["A composite steel plate for marine construction was fabricated using 316L stainless steel.", 'SteelBERT'],
|
10 |
["The use of composite [MASK] in construction is growing rapidly.", 'SteelBERT'],
|
11 |
["Advances in [MASK] science are leading to stronger and more durable steel products.", 'SteelBERT'],
|
|
|
14 |
["Nano-engineered [MASK] have the potential to revolutionize the steel industry with their superior properties.", 'SteelBERT']
|
15 |
]
|
16 |
|
17 |
+
# Load interfaces for different models
|
18 |
io1 = gr.Interface.load("huggingface/SteelBERT")
|
|
|
19 |
io2 = gr.Interface.load("huggingface/bert-base-uncased")
|
20 |
|
|
|
21 |
def inference(inputtext, model):
|
22 |
if model == "SteelBERT":
|
23 |
outlabel = io1(inputtext)
|
24 |
else:
|
25 |
outlabel = io2(inputtext)
|
26 |
return outlabel
|
|
|
27 |
|
28 |
gr.Interface(
|
29 |
+
fn=inference,
|
30 |
+
inputs=[
|
31 |
+
gr.Textbox(label="Context", lines=10),
|
32 |
+
gr.Dropdown(choices=["SteelBERT", "bert-base-uncased"], type="value", default="SteelBERT", label="Model")
|
33 |
+
],
|
34 |
+
outputs=gr.Label(label="Output"),
|
35 |
examples=examples,
|
36 |
title=title,
|
37 |
+
description=description
|
38 |
+
).launch(enable_queue=True)
|