mikeee commited on
Commit
e192b07
1 Parent(s): 8745ab1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -71,12 +71,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
71
  text_embed = gr.Textbox("Generate embeddings")
72
  embed_btn = gr.Button("Click to embed")
73
 
74
- reset_btn = gr.Button("Reset everything", visible=False)
75
 
76
  with gr.Tab("Query docs"): # Tab1
77
  # interactive chat
78
  chatbot = gr.Chatbot()
79
  msg = gr.Textbox(label="Query")
 
80
  clear = gr.Button("Clear")
81
 
82
  # actions
@@ -84,6 +85,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
84
  """Reset ns."""
85
  # global ns
86
  globals().update(**{"ns": deepcopy(ns_initial)})
 
87
  return f"reset done: ns={ns}"
88
 
89
  # Tab1
@@ -94,7 +96,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
94
 
95
  # Tab2
96
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
97
- clear.click(lambda: None, None, chatbot, queue=False)
 
 
98
 
99
  if __name__ == "__main__":
100
  demo.queue(concurrency_count=20).launch()
 
71
  text_embed = gr.Textbox("Generate embeddings")
72
  embed_btn = gr.Button("Click to embed")
73
 
74
+ reset_btn = gr.Button("Reset everything", visible=True)
75
 
76
  with gr.Tab("Query docs"): # Tab1
77
  # interactive chat
78
  chatbot = gr.Chatbot()
79
  msg = gr.Textbox(label="Query")
80
+ msg_submitbtn = gr.Button("Submit")
81
  clear = gr.Button("Clear")
82
 
83
  # actions
 
85
  """Reset ns."""
86
  # global ns
87
  globals().update(**{"ns": deepcopy(ns_initial)})
88
+ logger.debug(f"reset to {ns=}")
89
  return f"reset done: ns={ns}"
90
 
91
  # Tab1
 
96
 
97
  # Tab2
98
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
99
+ msg_submitbtn.click(respond, [msg, chatbot], [msg, chatbot])
100
+ clear.click(lambda: None, None, chatbot, queue=True)
101
+
102
 
103
  if __name__ == "__main__":
104
  demo.queue(concurrency_count=20).launch()