Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,8 @@ def greet(inp, messages):
|
|
| 6 |
return "Hello " + inp + "!"
|
| 7 |
|
| 8 |
def clear_memory(messages):
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
stored_message = gr.State([])
|
|
@@ -21,5 +22,5 @@ with gr.Blocks() as demo:
|
|
| 21 |
out_text = gr.Text(lines=15, label="Output", scale=2)
|
| 22 |
btn1.click(fn=greet, inputs=[text1, stored_message], outputs=out_text)
|
| 23 |
btn2.click(lambda: [None, None], outputs=[text1, out_text])
|
| 24 |
-
btn3.click(fn=clear_memory, inputs=[stored_message], outputs=[out_text
|
| 25 |
demo.launch()
|
|
|
|
| 6 |
return "Hello " + inp + "!"
|
| 7 |
|
| 8 |
def clear_memory(messages):
|
| 9 |
+
messages = []
|
| 10 |
+
return "Memory cleaned."
|
| 11 |
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
stored_message = gr.State([])
|
|
|
|
| 22 |
out_text = gr.Text(lines=15, label="Output", scale=2)
|
| 23 |
btn1.click(fn=greet, inputs=[text1, stored_message], outputs=out_text)
|
| 24 |
btn2.click(lambda: [None, None], outputs=[text1, out_text])
|
| 25 |
+
btn3.click(fn=clear_memory, inputs=[stored_message], outputs=[out_text])
|
| 26 |
demo.launch()
|