minoD commited on
Commit
a73ac5d
·
1 Parent(s): fed4554
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -1,9 +1,21 @@
1
  import gradio as gr
2
 
3
  def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  if __name__ == "__main__":
9
  iface.launch(share=True)
 
1
  import gradio as gr
2
 
3
  def greet(name):
4
+ return "Hello " + name + "!"
5
 
6
+ def another_endpoint(text):
7
+ return f"You said: {text}"
8
+
9
+ with gr.Blocks() as iface:
10
+ name_input = gr.Textbox(label="Enter your name")
11
+ output = gr.Textbox(label="Greeting")
12
+ greet_button = gr.Button("Greet")
13
+ greet_button.click(greet, inputs=name_input, outputs=output, api_name="/greet")
14
+
15
+ text_input = gr.Textbox(label="Enter some text")
16
+ text_output = gr.Textbox(label="Echo")
17
+ echo_button = gr.Button("Echo")
18
+ echo_button.click(another_endpoint, inputs=text_input, outputs=text_output, api_name="/echo")
19
 
20
  if __name__ == "__main__":
21
  iface.launch(share=True)