Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,8 +28,6 @@ def pdf_changes(pdf_doc):
|
|
28 |
llm=OpenAI(temperature=0.5),
|
29 |
retriever=retriever,
|
30 |
return_source_documents=False)
|
31 |
-
global chat_history
|
32 |
-
chat_history = []
|
33 |
return "Ready"
|
34 |
|
35 |
def add_text(history, text):
|
@@ -37,12 +35,12 @@ def add_text(history, text):
|
|
37 |
return history, ""
|
38 |
|
39 |
def bot(history):
|
40 |
-
response = infer(history[-1][0])
|
41 |
history[-1][1] = response
|
42 |
return history
|
43 |
|
44 |
-
def infer(question):
|
45 |
-
|
46 |
query = question
|
47 |
result = qa({"question": query, "chat_history": chat_history})
|
48 |
print(result)
|
|
|
28 |
llm=OpenAI(temperature=0.5),
|
29 |
retriever=retriever,
|
30 |
return_source_documents=False)
|
|
|
|
|
31 |
return "Ready"
|
32 |
|
33 |
def add_text(history, text):
|
|
|
35 |
return history, ""
|
36 |
|
37 |
def bot(history):
|
38 |
+
response = infer(history[-1][0], history)
|
39 |
history[-1][1] = response
|
40 |
return history
|
41 |
|
42 |
+
def infer(question, history):
|
43 |
+
chat_history = history
|
44 |
query = question
|
45 |
result = qa({"question": query, "chat_history": chat_history})
|
46 |
print(result)
|