testVariable3 / app.py
eternalBlissard's picture
Update app.py
5c42fbb verified
raw
history blame
399 Bytes
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()