Spaces:
Sleeping
Sleeping
File size: 465 Bytes
f154467 783515c d1bdca6 783515c c07d010 8a54fbe d1bdca6 c07d010 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
def change_tab(id):
return gr.Tabs(selected=id)
with gr.Blocks() as demo:
with gr.Tabs() as tabs:
with gr.TabItem("Train", id=0): #index is 0
t = gr.Textbox()
with gr.TabItem("Inference", id=1): #index is 1
i = gr.Image()
btn = gr.Button()
# When the button is clicked, switch to Tab1 (index 1)
btn.click(change_tab, gr.Number(1, visible=False), tabs)
demo.launch() |