bohmian commited on
Commit
8975dfa
·
verified ·
1 Parent(s): f1f3cfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -606,7 +606,7 @@ if page == "View Source Docs for Last Query":
606
  try:
607
  st.subheader(st.session_state['source_documents'][0])
608
  for doc in st.session_state['source_documents'][1:]:
609
- #st.write("Source: " + doc.metadata['source'])
610
  st.write(doc)
611
  except:
612
  st.write("No source documents retrieved yet. Please run a full user query before coming back to this page.")
@@ -681,17 +681,16 @@ if page == "Scrape or Upload Own Docs":
681
  st.subheader(f"Selected Option: {option}")
682
  uploaded_pdf = st.file_uploader("Upload a PDF")
683
  if uploaded_pdf:
684
- temp_file = "./temp.pdf"
685
  with open(temp_file, "wb") as file:
686
  file.write(uploaded_pdf.getvalue())
687
- pdf_filename = uploaded_pdf.name
688
  submit_upload_pdf = st.form_submit_button(label='Upload and Create Vector Store (Scroll down after clicking)')
689
  st.markdown(":blue[NOTE:] After you are done creating the vectore store, the country will appear under :blue[Countries to Override in the 'Document Config'] section of the left sidebar. Select the country to override it.")
690
 
691
 
692
  if submit_upload_pdf:
693
  try:
694
- with st.spinner('Generating documents from PDF...'):
695
  all_documents = pdf_loader_local(temp_file, country_scrape_upload)
696
  #st.write(all_documents)
697
  save_new_retrievers(all_documents, st.session_state['chunk_size'], st.session_state['chunk_overlap'], country_scrape_upload)
@@ -725,6 +724,6 @@ if page == "Scrape or Upload Own Docs":
725
  except:
726
  st.write("Waiting for web scraping results.")
727
 
728
- with st.spinner('Generating documents from web search results...'):
729
  all_documents = process_links_load_documents(all_links)
730
  save_new_retrievers(all_documents, st.session_state['chunk_size'], st.session_state['chunk_overlap'], country_scrape_upload)
 
606
  try:
607
  st.subheader(st.session_state['source_documents'][0])
608
  for doc in st.session_state['source_documents'][1:]:
609
+ #st.write("Source: " + doc['page_content'])
610
  st.write(doc)
611
  except:
612
  st.write("No source documents retrieved yet. Please run a full user query before coming back to this page.")
 
681
  st.subheader(f"Selected Option: {option}")
682
  uploaded_pdf = st.file_uploader("Upload a PDF")
683
  if uploaded_pdf:
684
+ temp_file = uploaded_pdf.name
685
  with open(temp_file, "wb") as file:
686
  file.write(uploaded_pdf.getvalue())
 
687
  submit_upload_pdf = st.form_submit_button(label='Upload and Create Vector Store (Scroll down after clicking)')
688
  st.markdown(":blue[NOTE:] After you are done creating the vectore store, the country will appear under :blue[Countries to Override in the 'Document Config'] section of the left sidebar. Select the country to override it.")
689
 
690
 
691
  if submit_upload_pdf:
692
  try:
693
+ with st.spinner('Generating documents from PDF...may take more than 5 mins...'):
694
  all_documents = pdf_loader_local(temp_file, country_scrape_upload)
695
  #st.write(all_documents)
696
  save_new_retrievers(all_documents, st.session_state['chunk_size'], st.session_state['chunk_overlap'], country_scrape_upload)
 
724
  except:
725
  st.write("Waiting for web scraping results.")
726
 
727
+ with st.spinner('Generating documents from web search results...may take more than 5 mins...'):
728
  all_documents = process_links_load_documents(all_links)
729
  save_new_retrievers(all_documents, st.session_state['chunk_size'], st.session_state['chunk_overlap'], country_scrape_upload)