Spaces:
Sleeping
Sleeping
eternalBlissard
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
val = newVal
|
8 |
-
return val
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
demo.launch()
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def respond(newVal, previous_val):
|
4 |
+
if previous_val is None:
|
5 |
+
previous_val = newVal
|
6 |
+
return previous_val
|
|
|
|
|
7 |
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
val = gr.State(None)
|
10 |
+
input_text = gr.Textbox(label="Input")
|
11 |
+
output_text = gr.Textbox(label="Output")
|
|
|
12 |
|
13 |
+
input_text.change(respond, [input_text, val], val)
|
14 |
+
val.change(lambda val: val, val, output_text)
|
15 |
+
|
16 |
+
demo.launch()
|