FlipperDudeManGuy commited on
Commit
6cfc8fc
·
1 Parent(s): 49520e6

Add application file

Browse files
Files changed (1) hide show
  1. app.py +9 -34
app.py CHANGED
@@ -1,38 +1,13 @@
1
  import gradio as gr
2
 
3
- def someotherfunction(id):
4
- return "id: " + id
5
- def my_inference_function(name):
6
- return "Hello " + name + "!"
7
-
8
- block = gr.Blocks(css=".gradio-container {background-color: lightgray}")
9
 
10
- with block:
11
- with gr.Row():
12
- gr.Markdown("<h3><center>REST API Test</center></h3>")
13
- with gr.Row():
14
- message = gr.Textbox(
15
- label="What's your question?",
16
- placeholder="What's the answer to life, the universe, and everything?",
17
- lines=4,
18
- )
19
-
20
- submitMe = gr.Button(value="Send", variant="secondary")
21
- output = gr.Textbox(label="Answer", lines=4, readonly=True)
22
- gr.Examples(
23
- examples=[
24
- "What are agents?",
25
- "How do I summarize a long document?",
26
- "What types of memory exist?",
27
- ],
28
- inputs=message,
29
- )
30
-
31
- gr.HTML(
32
- "<center>Powered by </center>"
33
- )
34
-
35
- submitMe.click(my_inference_function, inputs=message, outputs=output, api_name="askme")
36
-
37
 
38
- block.launch(debug=True)
 
1
  import gradio as gr
2
 
3
+ def greet(name):
4
+ return "Hello " + name + "!"
 
 
 
 
5
 
6
+ with gr.Blocks() as demo:
7
+ name = gr.Textbox(label="Name")
8
+ output = gr.Textbox(label="Output Box")
9
+ greet_btn = gr.Button("Greet")
10
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
11
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ demo.launch()