DrishtiSharma commited on
Commit
985938f
Β·
verified Β·
1 Parent(s): 18753fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -153,21 +153,24 @@ if st.session_state.chunked and not st.session_state.vector_created:
153
  # ----------------- Query Input -----------------
154
  query = None
155
 
156
- # Step 1: No PDF Provided Yet
157
- if not st.session_state.pdf_path and not st.session_state.get("trigger_download", False):
 
 
 
158
  st.info("πŸ“₯ **Please upload a PDF or enter a valid URL to proceed.**")
159
 
160
- # Step 2: PDF URL Exists but Not Processed Yet
161
- elif st.session_state.pdf_path and not st.session_state.pdf_loaded and not st.session_state.get("trigger_download", False):
162
  st.warning("⚠️ **PDF detected! Click 'Download and Process PDF' to start processing.**")
163
 
164
- # Step 3: Processing in Progress
165
  elif st.session_state.get("trigger_download", False) and (
166
  not st.session_state.pdf_loaded or not st.session_state.chunked or not st.session_state.vector_created
167
  ):
168
  st.info("⏳ **Processing your document... Please wait.**")
169
 
170
- # Step 4: Processing Complete, Ready for Questions
171
  elif st.session_state.pdf_loaded and st.session_state.chunked and st.session_state.vector_created:
172
  st.success("πŸŽ‰ **Processing complete! You can now ask questions.**")
173
  query = st.text_input("πŸ” **Ask a question about the document:**")
 
153
  # ----------------- Query Input -----------------
154
  query = None
155
 
156
+ # Check if a valid PDF URL has been entered (but not processed yet)
157
+ pdf_url_entered = bool(st.session_state.get("pdf_url")) # Checks if text is in the input box
158
+
159
+ # No PDF Provided Yet
160
+ if not st.session_state.pdf_path and not pdf_url_entered:
161
  st.info("πŸ“₯ **Please upload a PDF or enter a valid URL to proceed.**")
162
 
163
+ # PDF URL Exists but Not Processed Yet (Only show if URL exists but hasn't been downloaded)
164
+ elif pdf_url_entered and not st.session_state.pdf_loaded:
165
  st.warning("⚠️ **PDF detected! Click 'Download and Process PDF' to start processing.**")
166
 
167
+ # Processing in Progress
168
  elif st.session_state.get("trigger_download", False) and (
169
  not st.session_state.pdf_loaded or not st.session_state.chunked or not st.session_state.vector_created
170
  ):
171
  st.info("⏳ **Processing your document... Please wait.**")
172
 
173
+ # βœ… Step 4: Processing Complete, Ready for Questions
174
  elif st.session_state.pdf_loaded and st.session_state.chunked and st.session_state.vector_created:
175
  st.success("πŸŽ‰ **Processing complete! You can now ask questions.**")
176
  query = st.text_input("πŸ” **Ask a question about the document:**")