Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
#9
by
Uzaiir
- opened
- src/streamlit_app.py +25 -2
src/streamlit_app.py
CHANGED
|
@@ -64,15 +64,38 @@ main_placeholder = st.empty()
|
|
| 64 |
#Document upload
|
| 65 |
uploaded_file = st.sidebar.file_uploader("_____________________________________", type="pdf", accept_multiple_files=True)
|
| 66 |
st.sidebar.write("Press Submit to process:")
|
|
|
|
|
|
|
|
|
|
| 67 |
process = st.sidebar.button("Submit")
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
#Document processing to convert it into vectors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
if process:
|
| 71 |
if uploaded_file:
|
| 72 |
-
#
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
else:
|
| 75 |
st.warning("Please upload a PDF file.")
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
if input_method == "Choose input method...":
|
| 78 |
st.title(f"Welcome You all!")
|
|
|
|
| 64 |
#Document upload
|
| 65 |
uploaded_file = st.sidebar.file_uploader("_____________________________________", type="pdf", accept_multiple_files=True)
|
| 66 |
st.sidebar.write("Press Submit to process:")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
process = st.sidebar.button("Submit")
|
| 71 |
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
#Document processing to convert it into vectors
|
| 77 |
+
# if process:
|
| 78 |
+
# if uploaded_file:
|
| 79 |
+
# # Process the uploaded PDF file
|
| 80 |
+
# process_pdf(uploaded_file)
|
| 81 |
+
# else:
|
| 82 |
+
# st.warning("Please upload a PDF file.")
|
| 83 |
+
|
| 84 |
+
# Document processing
|
| 85 |
if process:
|
| 86 |
if uploaded_file:
|
| 87 |
+
# Save to /tmp/ before processing
|
| 88 |
+
file_path = f"/tmp/{uploaded_file.name}"
|
| 89 |
+
with open(file_path, "wb") as f:
|
| 90 |
+
f.write(uploaded_file.getbuffer())
|
| 91 |
+
|
| 92 |
+
# Call your existing logic with the saved path
|
| 93 |
+
process_pdf(file_path)
|
| 94 |
else:
|
| 95 |
st.warning("Please upload a PDF file.")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
|
| 100 |
if input_method == "Choose input method...":
|
| 101 |
st.title(f"Welcome You all!")
|