sonali-tamhankar commited on
Commit
cd8a181
1 Parent(s): f62ef6b

Add links to pages.

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,7 +4,7 @@ from langchain import HuggingFaceHub
4
  from langchain.chains import RetrievalQA
5
  import streamlit as st
6
 
7
- st.set_page_config(page_title = "Hospital Regulatory Chat", page_icon=":hospital:")
8
 
9
  DB_FAISS_PATH = '.'
10
 
@@ -48,9 +48,9 @@ if (st.button("Find Matches")):
48
 
49
  for i in range(n):
50
  with st.container():
51
- #st.subheader(source_dictionary[answer['source_documents'][i].metadata['source']])
52
- page_no = "**Page: " + str(answer['source_documents'][i].metadata['page']) + "**"
53
- st.markdown(page_no)
54
  st.write("...")
55
  st.write(answer['source_documents'][i].page_content)
56
  st.write("...")
 
4
  from langchain.chains import RetrievalQA
5
  import streamlit as st
6
 
7
+ st.set_page_config(page_title = "Solid Tumor Chat", page_icon=":hospital:")
8
 
9
  DB_FAISS_PATH = '.'
10
 
 
48
 
49
  for i in range(n):
50
  with st.container():
51
+ page = answer['source_documents'][i].metadata['page'] +1 # I don't understand why 1 should be added but it works
52
+ page_link = "[**Page: " + str(page) + "**](https://seer.cancer.gov/tools/solidtumor/2023/STM_Combined.pdf#page=" + str(page) + ")"
53
+ st.markdown(page_link)
54
  st.write("...")
55
  st.write(answer['source_documents'][i].page_content)
56
  st.write("...")