Commit
·
211d0af
1
Parent(s):
2545c31
syntax is fun
Browse files
app.py
CHANGED
@@ -54,15 +54,15 @@ def bot(history):
|
|
54 |
|
55 |
def infer(question, history):
|
56 |
try:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
except Exception as e:
|
67 |
return f"Error querying chatbot: {str(e)}"
|
68 |
|
|
|
54 |
|
55 |
def infer(question, history):
|
56 |
try:
|
57 |
+
res = []
|
58 |
+
for human, ai in history[:-1]:
|
59 |
+
pair = (human, ai)
|
60 |
+
res.append(pair)
|
61 |
|
62 |
+
chat_history = res
|
63 |
+
query = question
|
64 |
+
result = qa({"question": query, "chat_history": chat_history, "system": "This is a world-class summarizing AI, be helpful."})
|
65 |
+
return result["answer"]
|
66 |
except Exception as e:
|
67 |
return f"Error querying chatbot: {str(e)}"
|
68 |
|