fruitpicker01's picture
Update app.py
d1bdca6 verified
raw
history blame
465 Bytes
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()