Raghav001 commited on
Commit
e152e0a
·
1 Parent(s): c759623

clr 12 added q_bu

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -103,7 +103,7 @@ def get_response(msg, bot, doc_text_list, doc_embeddings):
103
  )
104
  res = result.json()['content']
105
  bot.append([msg, res])
106
- return "", bot[max(0, len(bot) - 3):]
107
 
108
 
109
  def up_file(files):
@@ -168,11 +168,13 @@ with gr.Blocks(css=".gradio-container {background-color: Tomato}, footer {visibi
168
  md = gr.Markdown("Please Upload the PDF")
169
  chat_bot = gr.Chatbot(visible=False)
170
  msg_txt = gr.Textbox(visible = False)
 
171
  chat_bu = gr.Button(value='Clear', visible=False)
172
 
173
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
174
- doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
175
  msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot],queue=False)
 
176
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
177
 
178
  if __name__ == "__main__":
 
103
  )
104
  res = result.json()['content']
105
  bot.append([msg, res])
106
+ return bot[max(0, len(bot) - 3):]
107
 
108
 
109
  def up_file(files):
 
168
  md = gr.Markdown("Please Upload the PDF")
169
  chat_bot = gr.Chatbot(visible=False)
170
  msg_txt = gr.Textbox(visible = False)
171
+ q_bu = gr.Button(value='Erase', visible=False)
172
  chat_bu = gr.Button(value='Clear', visible=False)
173
 
174
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
175
+ doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, q_bu, md, chat_bot])
176
  msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot],queue=False)
177
+ q_bu.click(lambda: None, None, msg_txt, queue=False)
178
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
179
 
180
  if __name__ == "__main__":