Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,4 +10,25 @@ examples = [
|
|
| 10 |
['Paris is the [MASK] of France.']
|
| 11 |
]
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
['Paris is the [MASK] of France.']
|
| 11 |
]
|
| 12 |
|
| 13 |
+
|
| 14 |
+
io1 = gr.Interface.load("huggingface/albert-base-v1")
|
| 15 |
+
|
| 16 |
+
io2 = gr.Interface.load("huggingface/albert-base-v2")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def inference(inputtext, model):
|
| 20 |
+
if model == "albert-base-v1":
|
| 21 |
+
outlabel = io1(inputtext)
|
| 22 |
+
else:
|
| 23 |
+
outlabel = io2(inputtext)
|
| 24 |
+
return outlabel
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
gr.Interface(
|
| 28 |
+
inference,
|
| 29 |
+
[gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["albert-base-v1","albert-base-v2"], type="value", default="albert-base-v1", label="model")],
|
| 30 |
+
[gr.outputs.Label(label="Output")],
|
| 31 |
+
examples=examples,
|
| 32 |
+
article=article,
|
| 33 |
+
title=title,
|
| 34 |
+
description=description).launch(enable_queue=True,cache_examples=True)
|