fruitpicker01 commited on
Commit
d1bdca6
1 Parent(s): 178cb3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,18 +1,17 @@
1
  import gradio as gr
2
 
3
- # Функция для смены вкладки
4
- def switch_tab():
5
- return gr.Tabs.update(selected=1)
6
 
7
  with gr.Blocks() as demo:
8
  with gr.Tabs() as tabs:
9
- with gr.TabItem("Вкладка 1", id=0):
10
- gr.Markdown("Это первая вкладка")
11
- with gr.TabItem("Вкладка 2", id=1):
12
- gr.Markdown("Это вторая вкладка")
13
-
14
- # Кнопка для переключения на вторую вкладку
15
- btn = gr.Button("Переключиться на вторую вкладку")
16
- btn.click(switch_tab, None, tabs)
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()