Spaces:
Sleeping
Sleeping
Commit
·
cdc45b2
1
Parent(s):
1ec0e71
init
Browse files
app.py
CHANGED
@@ -1,34 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
examples = [
|
10 |
-
['Paris is the [MASK] of France.','bert-base-cased']
|
11 |
-
]
|
12 |
-
|
13 |
-
|
14 |
-
io1 = gr.Interface.load("huggingface/bert-base-cased")
|
15 |
-
|
16 |
-
io2 = gr.Interface.load("huggingface/bert-base-uncased")
|
17 |
-
|
18 |
-
|
19 |
-
def inference(inputtext, model):
|
20 |
-
if model == "bert-base-cased":
|
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=["bert-base-cased","bert-base-uncased"], type="value", default="bert-base-cased", label="model")],
|
30 |
-
[gr.outputs.Label(label="Output")],
|
31 |
-
examples=examples,
|
32 |
-
article=article,
|
33 |
-
title=title,
|
34 |
-
description=description).launch(enable_queue=True)
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def greet(name):
|
4 |
+
return "Hello " + name + "!"
|
5 |
|
6 |
+
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
7 |
+
|
8 |
+
if __name__ == "__main__":
|
9 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|