Spaces:
Sleeping
Sleeping
Commit
·
f95de96
1
Parent(s):
8ae1bd1
adding chatbot with advanced options
Browse files
app.py
CHANGED
|
@@ -105,17 +105,17 @@ def process_pdf_document(document_file):
|
|
| 105 |
return document
|
| 106 |
|
| 107 |
def infer(question, history):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
-
for human, ai in history[:-1]:
|
| 111 |
-
pair = (human, ai)
|
| 112 |
-
res.append(pair)
|
| 113 |
-
|
| 114 |
-
chat_history = res
|
| 115 |
result = qa({"query": question})
|
| 116 |
return result["result"]
|
| 117 |
|
| 118 |
def bot(history):
|
|
|
|
| 119 |
response = infer(history[-1][0], history)
|
| 120 |
history[-1][1] = ""
|
| 121 |
|
|
|
|
| 105 |
return document
|
| 106 |
|
| 107 |
def infer(question, history):
|
| 108 |
+
# res = []
|
| 109 |
+
# # for human, ai in history[:-1]:
|
| 110 |
+
# # pair = (human, ai)
|
| 111 |
+
# # res.append(pair)
|
| 112 |
|
| 113 |
+
# chat_history = res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
result = qa({"query": question})
|
| 115 |
return result["result"]
|
| 116 |
|
| 117 |
def bot(history):
|
| 118 |
+
print("History :",history)
|
| 119 |
response = infer(history[-1][0], history)
|
| 120 |
history[-1][1] = ""
|
| 121 |
|