Huzaifa367 commited on
Commit
1925f84
·
verified ·
1 Parent(s): 7274bf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -89,21 +89,23 @@ def main():
89
  with st.sidebar:
90
  st.header("Chat with PDF")
91
  # st.title("Menu:")
92
- pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit Button", accept_multiple_files=True, type=["pdf"])
93
- if st.button("Submit"):
94
- with st.spinner("Processing..."):
95
- raw_text = get_pdf_text(pdf_docs)
96
- text_chunks = get_text_chunks(raw_text)
97
- get_vector_store(text_chunks, api_key)
98
- st.success("Done")
99
-
100
- # Check if any document is uploaded
101
- if pdf_docs:
102
- user_question = st.text_input("Ask a question from the Docs")
103
- if user_question:
104
  user_input(user_question, api_key)
105
- else:
106
- st.write("Please upload a document first to ask questions.")
 
 
 
 
 
 
107
 
108
  if __name__ == "__main__":
109
  main()
 
89
  with st.sidebar:
90
  st.header("Chat with PDF")
91
  # st.title("Menu:")
92
+ pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit Button", accept_multiple_files=True, type=["pdf"])
93
+ if st.button("Submit"):
94
+ with st.spinner("Processing..."):
95
+ raw_text = get_pdf_text(pdf_docs)
96
+ text_chunks = get_text_chunks(raw_text)
97
+ get_vector_store(text_chunks, api_key)
98
+ st.success("Done")
99
+ user_question = st.text_input("Ask a question from the Docs")
 
 
 
 
100
  user_input(user_question, api_key)
101
+
102
+ # # Check if any document is uploaded
103
+ # if pdf_docs:
104
+ # user_question = st.text_input("Ask a question from the Docs")
105
+ # if user_question:
106
+ # user_input(user_question, api_key)
107
+ # else:
108
+ # st.write("Please upload a document first to ask questions.")
109
 
110
  if __name__ == "__main__":
111
  main()