abidlabs HF Staff commited on
Commit
24dd87b
·
verified ·
1 Parent(s): b51d94e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -18
app.py CHANGED
@@ -1,23 +1,11 @@
1
  import gradio as gr
2
- import random
3
 
4
- with gr.Blocks() as demo:
5
- name = gr.Textbox(label="Name")
6
- output = gr.Textbox(label="Output Box")
7
- greet_btn = gr.Button("Greet")
8
- @gr.on([greet_btn.click, name.submit], inputs=name, outputs=output, api_name="greet")
9
- def greet(name):
10
- return "Hello " + name + "!"
11
-
12
- with demo.route("Up") as incrementer_demo:
13
- num = gr.Number()
14
- incrementer_demo.load(lambda: random.randint(10, 40), None, num)
15
 
16
- with gr.Row():
17
- inc_btn = gr.Button("Increase")
18
- dec_btn = gr.Button("Decrease")
19
- inc_btn.click(fn=lambda x: x + 1, inputs=num, outputs=num, api_name="increment")
20
- dec_btn.click(fn=lambda x: x - 1, inputs=num, outputs=num, api_name="decrement")
21
 
22
  if __name__ == "__main__":
23
- demo.launch(ssr_mode=True)
 
1
  import gradio as gr
 
2
 
3
+ import main_page, second_page
 
 
 
 
 
 
 
 
 
 
4
 
5
+ with gr.Blocks() as demo:
6
+ main_page.render()
7
+ with demo.route("Second Page"):
8
+ second_page.render()
 
9
 
10
  if __name__ == "__main__":
11
+ demo.launch()