Raghav001 commited on
Commit
92338ad
·
1 Parent(s): 50d184f
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -128,7 +128,6 @@ def get_response(msg, bot, doc_text_list, doc_embeddings):
128
  )
129
  res = result.json()['content']
130
  bot.append([msg, res])
131
- chat_bot.chat_history = doc_text_state.value
132
  return bot[max(0, len(bot) - 3):]
133
 
134
 
@@ -299,15 +298,13 @@ with gr.Blocks() as demo:
299
 
300
  with gr.Column():
301
  md = gr.Markdown("Please Upload the PDF")
302
- # chat_bot = gr.Chatbot(visible=False)
303
- chat_bot = gr.Chatbot(chat_history=bot, visible=False)
304
  msg_txt = gr.Textbox(visible = False)
305
  chat_bu = gr.Button(value='Clear', visible=False)
306
 
307
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
308
  doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
309
- # msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot],queue=False)
310
- msg_txt.submit(get_response, [msg_txt, chat_bot, doc_text_state, doc_emb_state], [chat_bot, doc_text_state], queue=False)
311
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
312
 
313
  if __name__ == "__main__":
 
128
  )
129
  res = result.json()['content']
130
  bot.append([msg, res])
 
131
  return bot[max(0, len(bot) - 3):]
132
 
133
 
 
298
 
299
  with gr.Column():
300
  md = gr.Markdown("Please Upload the PDF")
301
+ chat_bot = gr.Chatbot(visible=False)
 
302
  msg_txt = gr.Textbox(visible = False)
303
  chat_bu = gr.Button(value='Clear', visible=False)
304
 
305
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
306
  doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
307
+ msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot],queue=False)
 
308
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
309
 
310
  if __name__ == "__main__":