vaishnav commited on
Commit
63b3015
·
1 Parent(s): 9ff84d1

add reset memory cache button

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -31,13 +31,22 @@ def respond(user_input, history):
31
 
32
  return response
33
 
 
 
 
 
 
34
  if __name__ == '__main__':
35
  logging.info("Starting AIVIz Bot")
36
 
37
- # Using ChatInterface to create the chatbot interface
38
- chat_interface = gr.ChatInterface(
39
- fn=respond,
40
- title="AISDb ChatBot",
41
- )
 
 
 
42
 
43
- chat_interface.launch(share=True)
 
 
31
 
32
  return response
33
 
34
+
35
+ def on_reset_button_click():
36
+ llm_svc.store={}
37
+
38
+ # Define the main block
39
  if __name__ == '__main__':
40
  logging.info("Starting AIVIz Bot")
41
 
42
+ with gr.Blocks() as demo:
43
+ # Create the ChatInterface
44
+ chat_interface = gr.ChatInterface(fn=respond,title="AISDb ChatBot")
45
+
46
+ # Create a button and bind the reset function to it
47
+ reset_button = gr.Button("Reset Chat Memory Cache")
48
+
49
+ reset_button.click(on_reset_button_click)
50
 
51
+ # Launch the interface with a shareable link
52
+ demo.launch(share=True)