Update app.py
Browse files
app.py
CHANGED
|
@@ -35,12 +35,15 @@ def main():
|
|
| 35 |
st.title("Menu:")
|
| 36 |
pdf_docs = st.file_uploader("Upload your PDF Files", accept_multiple_files=True)
|
| 37 |
|
|
|
|
|
|
|
| 38 |
if pdf_docs and st.button("Submit & Process"):
|
| 39 |
with st.spinner("Processing PDFs..."):
|
| 40 |
raw_text = get_pdf_text(pdf_docs)
|
| 41 |
st.success("PDF content processed successfully!")
|
| 42 |
|
| 43 |
-
|
|
|
|
| 44 |
st.write("Fetching answer...")
|
| 45 |
response = get_gemini_response(user_question, raw_text)
|
| 46 |
st.write("Reply:", response)
|
|
|
|
| 35 |
st.title("Menu:")
|
| 36 |
pdf_docs = st.file_uploader("Upload your PDF Files", accept_multiple_files=True)
|
| 37 |
|
| 38 |
+
# Only process the PDFs if they are uploaded
|
| 39 |
+
raw_text = ""
|
| 40 |
if pdf_docs and st.button("Submit & Process"):
|
| 41 |
with st.spinner("Processing PDFs..."):
|
| 42 |
raw_text = get_pdf_text(pdf_docs)
|
| 43 |
st.success("PDF content processed successfully!")
|
| 44 |
|
| 45 |
+
# Ensure that both the question and PDF content are available before querying the model
|
| 46 |
+
if user_question and raw_text:
|
| 47 |
st.write("Fetching answer...")
|
| 48 |
response = get_gemini_response(user_question, raw_text)
|
| 49 |
st.write("Reply:", response)
|