Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,29 +73,27 @@ def main():
|
|
| 73 |
|
| 74 |
# Sidebar column for file upload
|
| 75 |
with st.sidebar:
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 78 |
# Main column for displaying extracted text and user interaction
|
| 79 |
col1, col2 = st.columns([1, 2])
|
| 80 |
|
| 81 |
if pdf_docs and col1.button("Submit"):
|
| 82 |
with col1:
|
| 83 |
-
|
| 84 |
-
st.spinner("Processing..."):
|
| 85 |
raw_text = get_pdf_text(pdf_docs)
|
| 86 |
text_chunks = get_text_chunks(raw_text)
|
| 87 |
get_vector_store(text_chunks, api_key)
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
user_question = st.text_input("Ask a question from the Docs")
|
| 91 |
-
if user_question:
|
| 92 |
-
user_input(user_question, api_key)
|
| 93 |
if raw_text:
|
| 94 |
with col2:
|
| 95 |
st.subheader("Extracted Text from PDF:")
|
| 96 |
st.text(raw_text)
|
| 97 |
-
|
| 98 |
-
|
|
|
|
| 99 |
|
| 100 |
if __name__ == "__main__":
|
| 101 |
main()
|
|
|
|
| 73 |
|
| 74 |
# Sidebar column for file upload
|
| 75 |
with st.sidebar:
|
| 76 |
+
st.header("Chat with PDF")
|
| 77 |
+
pdf_docs = st.file_uploader("Upload your PDF Files", accept_multiple_files=True, type=["pdf"])
|
| 78 |
+
|
| 79 |
# Main column for displaying extracted text and user interaction
|
| 80 |
col1, col2 = st.columns([1, 2])
|
| 81 |
|
| 82 |
if pdf_docs and col1.button("Submit"):
|
| 83 |
with col1:
|
| 84 |
+
st.spinner("Processing...")
|
|
|
|
| 85 |
raw_text = get_pdf_text(pdf_docs)
|
| 86 |
text_chunks = get_text_chunks(raw_text)
|
| 87 |
get_vector_store(text_chunks, api_key)
|
| 88 |
+
st.success("Processing Complete")
|
| 89 |
+
|
|
|
|
|
|
|
|
|
|
| 90 |
if raw_text:
|
| 91 |
with col2:
|
| 92 |
st.subheader("Extracted Text from PDF:")
|
| 93 |
st.text(raw_text)
|
| 94 |
+
user_question = st.text_input("Ask a question from the Docs")
|
| 95 |
+
if user_question:
|
| 96 |
+
user_input(user_question, api_key)
|
| 97 |
|
| 98 |
if __name__ == "__main__":
|
| 99 |
main()
|