Spaces:
Sleeping
Sleeping
fruitpicker01
commited on
Commit
•
d1bdca6
1
Parent(s):
178cb3d
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
return gr.Tabs.update(selected=1)
|
6 |
|
7 |
with gr.Blocks() as demo:
|
8 |
with gr.Tabs() as tabs:
|
9 |
-
with gr.TabItem("
|
10 |
-
gr.
|
11 |
-
with gr.TabItem("
|
12 |
-
gr.
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
btn.click(
|
17 |
-
|
18 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def change_tab(id):
|
4 |
+
return gr.Tabs(selected=id)
|
|
|
5 |
|
6 |
with gr.Blocks() as demo:
|
7 |
with gr.Tabs() as tabs:
|
8 |
+
with gr.TabItem("Train", id=0): #index is 0
|
9 |
+
t = gr.Textbox()
|
10 |
+
with gr.TabItem("Inference", id=1): #index is 1
|
11 |
+
i = gr.Image()
|
12 |
+
|
13 |
+
btn = gr.Button()
|
14 |
+
# When the button is clicked, switch to Tab1 (index 1)
|
15 |
+
btn.click(change_tab, gr.Number(1, visible=False), tabs)
|
16 |
+
|
17 |
demo.launch()
|