import gradio as gr def respond(newVal, previous_val): if previous_val is None: previous_val = newVal return previous_val with gr.Blocks() as demo: val = gr.State(None) input_text = gr.Textbox(label="Input") output_text = gr.Textbox(label="Output") input_text.change(respond, [input_text, val], val) val.change(lambda val: val, val, output_text) demo.launch()