shivam11 commited on
Commit
dc6e9a7
1 Parent(s): 6edec9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -14,6 +14,7 @@ load_dotenv()
14
  os.getenv("GOOGLE_API_KEY")
15
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
16
 
 
17
  # read all pdf files and return text
18
 
19
 
@@ -98,6 +99,10 @@ def main():
98
  "Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
99
  if st.button("Submit & Process"):
100
  with st.spinner("Processing..."):
 
 
 
 
101
  raw_text = get_pdf_text(pdf_docs)
102
  text_chunks = get_text_chunks(raw_text)
103
  get_vector_store(text_chunks)
 
14
  os.getenv("GOOGLE_API_KEY")
15
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
16
 
17
+ DEFAULT_PDF_FILES = ["2024_25_Annex_Budget.pdf", "2024_25_Budget_Speech.pdf"] # Define default PDFs
18
  # read all pdf files and return text
19
 
20
 
 
99
  "Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
100
  if st.button("Submit & Process"):
101
  with st.spinner("Processing..."):
102
+ for file_name in pdf_docs:
103
+ if not os.path.exists(file_name):
104
+ st.error(f"Default file '{file_name}' not found!")
105
+ return # Exit if a default file is missing
106
  raw_text = get_pdf_text(pdf_docs)
107
  text_chunks = get_text_chunks(raw_text)
108
  get_vector_store(text_chunks)