Spaces:
Sleeping
Sleeping
File size: 593 Bytes
f1bf98e 5c42fbb 0bf4cb9 5c42fbb f1bf98e 5c42fbb a66cb80 f1bf98e a66cb80 5c42fbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
def respond(newVal, previous_val):
if previous_val is None:
previous_val = newVal
else:
previous_val = newVal+"chalgaya"
return previous_val
with gr.Blocks() as demo:
val = gr.State(None)
input_text = gr.Textbox(label="Input")
output_text = gr.Textbox(label="Output")
submit_button = gr.Button("Submit")
def on_submit(newVal, previous_val):
updated_val = respond(newVal, previous_val)
return updated_val, updated_val
submit_button.click(on_submit, [input_text, val], [val, output_text])
demo.launch() |