htafer commited on
Commit
aea3c48
1 Parent(s): 76c1eb0

force source documents

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -66,13 +66,16 @@ def main():
66
  result = conversation_chain({"question": query})
67
  answer = result["answer"]
68
  st.write("Answer:", answer)
69
-
70
- # Optionally display source text snippets
71
- if st.checkbox("Show source text snippets"):
72
- st.write("Source documents:")
73
  for i in result["source_documents"]:
74
  res = re.search(r'^[^\n]*', i.page_content)
75
  st.write(i.page_content[res.span()[0]:res.span()[1]])
 
 
 
 
 
 
76
 
77
 
78
  if __name__ == "__main__":
 
66
  result = conversation_chain({"question": query})
67
  answer = result["answer"]
68
  st.write("Answer:", answer)
69
+ st.write("Source documents:")
 
 
 
70
  for i in result["source_documents"]:
71
  res = re.search(r'^[^\n]*', i.page_content)
72
  st.write(i.page_content[res.span()[0]:res.span()[1]])
73
+ # Optionally display source text snippets
74
+ # if st.checkbox("Show source text snippets"):
75
+ # st.write("Source documents:")
76
+ # for i in result["source_documents"]:
77
+ # res = re.search(r'^[^\n]*', i.page_content)
78
+ # st.write(i.page_content[res.span()[0]:res.span()[1]])
79
 
80
 
81
  if __name__ == "__main__":