Spaces:
Runtime error
Runtime error
added sources list
Browse files
app.py
CHANGED
@@ -38,10 +38,13 @@ def add_text(history, text):
|
|
38 |
def bot(history):
|
39 |
response = infer(history[-1][0])
|
40 |
history[-1][1] = response['result']
|
41 |
-
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
def infer(question):
|
44 |
-
|
45 |
query = question
|
46 |
result = qa({"query": query})
|
47 |
return result
|
|
|
38 |
def bot(history):
|
39 |
response = infer(history[-1][0])
|
40 |
history[-1][1] = response['result']
|
41 |
+
sources = [doc.metadata.get("source") for doc in response['source_documents']]
|
42 |
+
src_list = '\n'.join(sources)
|
43 |
+
print_this = response['result']+"\n\n\n Sources: \n\n\n"+src_list
|
44 |
+
# return history
|
45 |
+
return print_this
|
46 |
|
47 |
+
def infer(question):
|
|
|
48 |
query = question
|
49 |
result = qa({"query": query})
|
50 |
return result
|