DrishtiSharma commited on
Commit
7fa417c
Β·
verified Β·
1 Parent(s): 9042074

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -151,13 +151,15 @@ st.write("πŸ“‚ **Vector Store Created:**", st.session_state.vector_created)
151
 
152
 
153
  # ----------------- Query Input -----------------
154
- query = ""
155
- # Ensure the query input appears ONLY after the document is fully processed
 
156
  if st.session_state.pdf_loaded and st.session_state.chunked and st.session_state.vector_created:
157
  query = st.text_input("πŸ” Ask a question about the document:")
158
- else:
159
- st.info("πŸ“₯ Please wait for the PDF to be processed before asking a question.")
160
-
 
161
  if query:
162
  with st.spinner("πŸ”„ Retrieving relevant context..."):
163
  retriever = st.session_state.vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 4})
 
151
 
152
 
153
  # ----------------- Query Input -----------------
154
+ query = None
155
+
156
+ # Show input box ONLY when processing is fully done
157
  if st.session_state.pdf_loaded and st.session_state.chunked and st.session_state.vector_created:
158
  query = st.text_input("πŸ” Ask a question about the document:")
159
+
160
+ elif not st.session_state.pdf_path:
161
+ st.info("⬆️ Please upload or provide a PDF URL first.") # Show only if no PDF is provided
162
+
163
  if query:
164
  with st.spinner("πŸ”„ Retrieving relevant context..."):
165
  retriever = st.session_state.vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 4})