Hannah commited on
Commit
ef835f1
·
1 Parent(s): 639e40c
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +40 -0
  3. requirements.txt +1 -0
__pycache__/app.cpython-311.pyc ADDED
Binary file (5.15 kB). View file
 
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ with gr.Blocks() as demo:
4
+ with gr.Row():
5
+ def change_to_tab_two():
6
+ return gr.Tabs(selected=2) #This will navigate
7
+
8
+ with gr.Tabs() as tabs:
9
+ with gr.Tab(id=1, label="Tab 1", visible=True, interactive=True) as tab_one:
10
+ tab_one_tbox = gr.Textbox(label="Tab One Textbox")
11
+ tab_one_btn = gr.Button(value="Change Tab (shouldn't navigate)")
12
+ with gr.Tab(id=2, label="Tab 2", visible=True, interactive=False) as tab_two:
13
+ tab_two_tbox = gr.Textbox(label="Tab Two Textbox")
14
+ tab_one_btn.click(fn=change_to_tab_two,inputs=None, outputs=[tabs]) # This does navigate
15
+
16
+ with gr.Row():
17
+ def change_to_tab_two():
18
+ return gr.Tabs(selected=2), gr.Tab(label="New tab two label") #This won't navigate
19
+
20
+ with gr.Tabs() as tabs:
21
+ with gr.Tab(id=1, label="Tab 1", visible=True, interactive=True) as tab_one:
22
+ tab_one_tbox = gr.Textbox(label="Tab One Textbox")
23
+ tab_one_btn = gr.Button(value="Change Tab (should navigate)")
24
+ with gr.Tab(id=2, label="Tab 2", visible=True, interactive=True) as tab_two:
25
+ tab_two_tbox = gr.Textbox(label="Tab Two Textbox")
26
+ tab_one_btn.click(fn=change_to_tab_two, inputs=None, outputs=[tabs, tab_two])
27
+
28
+ with gr.Row():
29
+ def change_to_tab_two():
30
+ return gr.Tabs(selected=2), gr.Textbox(label="Textbox two new label")
31
+
32
+ with gr.Tabs() as tabs:
33
+ with gr.Tab(id=1, label="Tab 1", visible=True, interactive=True) as tab_one:
34
+ tab_one_tbox = gr.Textbox(label="Tab One Textbox")
35
+ tab_one_btn = gr.Button(value="Change Tab (should navigate)")
36
+ with gr.Tab(id=2, label="Tab 2", visible=True, interactive=True) as tab_two:
37
+ tab_two_tbox = gr.Textbox(label="Tab Two Textbox",interactive=False)
38
+ tab_one_btn.click(fn=change_to_tab_two, inputs=None, outputs=[tabs, tab_two_tbox]) #This doesn't navigate
39
+
40
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://gradio-builds.s3.amazonaws.com/88d899e9633ff04400de7866d25005aa925a2ad9/gradio-4.15.0-py3-none-any.whl