Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -89,21 +89,23 @@ def main():
|
|
89 |
with st.sidebar:
|
90 |
st.header("Chat with PDF")
|
91 |
# st.title("Menu:")
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
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 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|