Manglik-R commited on
Commit
ee7a93d
·
verified ·
1 Parent(s): 938d0d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -43,11 +43,19 @@ def pdf_changes(pdf_doc):
43
  )
44
  return "Ready"
45
 
 
 
 
 
 
 
 
46
  def query(history, text):
47
- result = qa({'question': text, 'chat_history': history})
48
- history.append((text, result['answer']))
 
49
 
50
- return history,""
51
 
52
  css="""
53
  #col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
 
43
  )
44
  return "Ready"
45
 
46
+ def format(query, history):
47
+ fhistory = []
48
+ for user, bot in history:
49
+ fhistory.append(f"User: {user}")
50
+ fhistory.append(f"Assistant: {bot}")
51
+ return fhistory
52
+
53
  def query(history, text):
54
+ fhistory = format(text,history)
55
+ result = qa({'question': text, 'chat_history': fhistory})
56
+ new_history = history + [(text,result['answer'])]
57
 
58
+ return new_history,""
59
 
60
  css="""
61
  #col-container {max-width: 700px; margin-left: auto; margin-right: auto;}