How to send the output of tab1 to the input of tab2 and activate tab2?

For example, I have following mini app :

import gradio as gr

def processing1(text):
    return "result1", "result2"
    
def send():
    pass

def processing2(text):
    return "result3"

tab1 = gr.Blocks()
with tab1:
    with gr.Row():
        with gr.Column():
            input_text = gr.TextArea(label="Input Text", placeholder="Paste your text here")
            submit_btn = gr.Button("submit")
        with gr.Column():
            output_text1 = gr.TextArea(label="Output Text")
            output_text2 = gr.TextArea(label="Output Text2")
            send_btn = gr.Button("send to tab2")
    submit_btn.click(processing1, inputs=[input_text], outputs=[output_text1, output_text2])
    send_btn.click(send)

tab2 = gr.Blocks()
with tab2:
    with gr.Row():
        with gr.Column():
            input_text2 = gr.TextArea(label="Input Text", placeholder="Paste your text here")
            checkbox1 = gr.Checkbox(label="checkbox1")
            checkbox2 = gr.Checkbox(label="checkbox2")
            submit_btn2 = gr.Button("submit")
        with gr.Column():
            output_text3 = gr.TextArea(label="Output Text")

    submit_btn2.click(processing2, inputs=input_text2, outputs=output_text3)

demo = gr.TabbedInterface([tab1, tab2], tab_names=["tab1", "tab2"])
demo.launch()

I want send the output of tab1 (here is the β€œresult2”) to the input of tab2(here is the input_text2) and active the tab2 as current tab, how to achieve this ?

I guess this could use javascript, but I am not familiar with javascript, so I don’n know how to do

Hi @wwdok it is possible to update the tab programmatically, please see: Be able to set the active `Tab` programmatically Β· Issue #2412 Β· gradio-app/gradio Β· GitHub

I try the code inside the link, it really activate the tab programmatically, thank you ! But I still have another question, that is how to send image and text from one tab to another tab programmatically.