ruslanmv commited on
Commit
7d2f309
·
verified ·
1 Parent(s): 7fa4214

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -153,7 +153,7 @@ def respond(
153
  # --- Gradio Interface ---
154
  # Clear function (Crucially, it returns an empty list for the history)
155
  def clear_memory():
156
- return []
157
 
158
  demo = gr.ChatInterface(
159
  respond,
@@ -169,7 +169,9 @@ demo = gr.ChatInterface(
169
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
170
  gr.Button("Clear Memory"),
171
  ],
172
- ).clear(clear_memory, [], []) # Call .clear, link it to the clear function, input, and output.
 
 
173
 
174
  if __name__ == "__main__":
175
  demo.launch(share=True)
 
153
  # --- Gradio Interface ---
154
  # Clear function (Crucially, it returns an empty list for the history)
155
  def clear_memory():
156
+ return [], "" # Return empty history AND clear the chatbot display
157
 
158
  demo = gr.ChatInterface(
159
  respond,
 
169
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
170
  gr.Button("Clear Memory"),
171
  ],
172
+ )
173
+ demo.clear(clear_memory, inputs=[], outputs=[demo.chatbot, demo.textbox])
174
+
175
 
176
  if __name__ == "__main__":
177
  demo.launch(share=True)