Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
7b82c26
1
Parent(s):
2bd4583
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,4 +10,24 @@ examples = [
|
|
| 10 |
["Paris est la <special1> de la France."]
|
| 11 |
]
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
["Paris est la <special1> de la France."]
|
| 11 |
]
|
| 12 |
|
| 13 |
+
|
| 14 |
+
io1 = gr.Interface.load("huggingface/flaubert/flaubert_small_cased")
|
| 15 |
+
|
| 16 |
+
io2 = gr.Interface.load("huggingface/flaubert/flaubert_base_cased")
|
| 17 |
+
|
| 18 |
+
def inference(inputtext, model):
|
| 19 |
+
if model == "flaubert_small_cased":
|
| 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=["flaubert_small_cased","flaubert_base_cased"], type="value", default="flaubert_small_cased", label="model")],
|
| 29 |
+
[gr.outputs.Label(label="Output")],
|
| 30 |
+
examples=examples,
|
| 31 |
+
article=article,
|
| 32 |
+
title=title,
|
| 33 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|