Shankarm08 commited on
Commit
930f177
·
verified ·
1 Parent(s): a52a9bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -29,9 +29,9 @@ def extract_text_from_pdf(pdf_file):
29
  text += page_text + "\n"
30
  return text
31
 
32
- # Load dataset (wiki_dpr) and set trust_remote_code=True
33
- def load_wiki_dpr():
34
- return load_dataset('wiki_dpr', trust_remote_code=True)
35
 
36
  # Store the PDF text and embeddings
37
  pdf_text = ""
@@ -58,6 +58,9 @@ if pdf_file:
58
  else:
59
  st.warning("No extractable text found in the PDF.")
60
 
 
 
 
61
  # User input for chatbot
62
  user_input = st.text_input("Ask a question related to the PDF or CSV:")
63
 
@@ -81,3 +84,4 @@ if st.button("Get Response"):
81
  except Exception as e:
82
  st.error(f"Error while processing the question: {e}")
83
 
 
 
29
  text += page_text + "\n"
30
  return text
31
 
32
+ # Load dataset (using SQuAD v2 as a placeholder)
33
+ def load_squad_v2():
34
+ return load_dataset('squad_v2')
35
 
36
  # Store the PDF text and embeddings
37
  pdf_text = ""
 
58
  else:
59
  st.warning("No extractable text found in the PDF.")
60
 
61
+ # Load the SQuAD v2 dataset as an example for RAG retrieval
62
+ dataset = load_squad_v2()
63
+
64
  # User input for chatbot
65
  user_input = st.text_input("Ask a question related to the PDF or CSV:")
66
 
 
84
  except Exception as e:
85
  st.error(f"Error while processing the question: {e}")
86
 
87
+