ShaohanTian commited on
Commit
e2d4d22
·
1 Parent(s): 643bcb6
Files changed (1) hide show
  1. app.py +8 -22
app.py CHANGED
@@ -1,27 +1,13 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Load the SteelBERT model for mask filling
5
- fill_mask = pipeline("fill-mask", model="MGE-LLMs/SteelBERT")
6
 
7
- # Define the Gradio interface
8
- def mask_filler(text):
9
- result = fill_mask(text)
10
- return result[0]["sequence"]
11
-
12
- iface = gr.Interface(
13
- fn=mask_filler,
14
- inputs=gr.Textbox(lines=3, label="Enter a sentence with [MASK] token"),
15
- outputs=gr.Textbox(label="Completed sentence"),
16
- title="SteelBERT Mask Filler",
17
- description="Fill in the masked token using SteelBERT.",
18
  )
19
 
20
- # Add some example inputs for the interface
21
- examples = [
22
- ["SteelBERT is a [MASK] model for filling in missing information."],
23
- ["I have a [MASK] of apples and oranges."],
24
- ]
25
-
26
- iface.examples = examples
27
- iface.launch()
 
1
  import gradio as gr
 
2
 
3
+ def greet(name, intensity):
4
+ return "Hello, " + name + "!" * intensity
5
 
6
+ demo = gr.Interface(
7
+ fn=greet,
8
+ inputs=["text", gr.Slider(value=2, minimum=1, maximum=10, step=1)],
9
+ outputs=[gr.Textbox(label="greeting", lines=3)],
 
 
 
 
 
 
 
10
  )
11
 
12
+ if __name__ == "__main__":
13
+ demo.launch()