Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
import random
|
3 |
|
4 |
-
|
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
dec_btn.click(fn=lambda x: x - 1, inputs=num, outputs=num, api_name="decrement")
|
21 |
|
22 |
if __name__ == "__main__":
|
23 |
-
demo.launch(
|
|
|
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()
|