vaishnaveswar commited on
Commit
912f3bc
·
verified ·
1 Parent(s): 0bf5164

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -12
app.py CHANGED
@@ -35,17 +35,31 @@ def respond(user_input, history):
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)
45
- # Create a button and bind the reset function to it
46
- reset_button = gr.Button("Reset Chat Memory Cache")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
- reset_button.click(on_reset_button_click)
49
 
50
- # Launch the interface with a shareable link
51
- demo.launch(share=True)
 
35
  def on_reset_button_click():
36
  llm_svc.store={}
37
 
38
+
39
+ demo = gr.ChatInterface(
40
+ fn=respond,
41
+ additional_inputs=[
42
+ gr.Button("Reset Chat Memory Cache", elem_id="reset_button")
43
+ ]
44
+ )
45
+
46
+ reset_button = demo.additional_inputs[0]
47
+ reset_button.click(on_reset_button_click)
48
+
49
+ if __name__ == "__main__":
50
+ demo.launch(share=True)
51
+
52
+ # # Define the main block
53
+ # if __name__ == '__main__':
54
+ # logging.info("Starting AIVIz Bot")
55
+
56
+ # with gr.Blocks() as demo:
57
+ # # Create the ChatInterface
58
+ # chat_interface = gr.ChatInterface(fn=respond)
59
+ # # Create a button and bind the reset function to it
60
+ # reset_button = gr.Button("Reset Chat Memory Cache")
61
 
62
+ # reset_button.click(on_reset_button_click)
63
 
64
+ # # Launch the interface with a shareable link
65
+ # demo.launch(share=True)