Spaces:
Sleeping
Sleeping
Create upload_files.py
Browse files- components/upload_files.py +10 -8
components/upload_files.py
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
|
| 4 |
def run_upload_files():
|
| 5 |
-
st.
|
| 6 |
-
uploaded_file = st.file_uploader("Upload your
|
| 7 |
|
| 8 |
-
if uploaded_file
|
| 9 |
-
save_path = os.path.join("
|
| 10 |
-
os.makedirs(
|
| 11 |
|
| 12 |
with open(save_path, "wb") as f:
|
| 13 |
-
f.write(uploaded_file.
|
| 14 |
|
| 15 |
-
st.
|
| 16 |
-
st.
|
|
|
|
| 1 |
+
# upload_files.py
|
| 2 |
+
|
| 3 |
import streamlit as st
|
| 4 |
import os
|
| 5 |
|
| 6 |
def run_upload_files():
|
| 7 |
+
st.title("📤 Upload Business Documents")
|
| 8 |
+
uploaded_file = st.file_uploader("Upload your business PDF", type=["pdf"])
|
| 9 |
|
| 10 |
+
if uploaded_file:
|
| 11 |
+
save_path = os.path.join("user_docs", uploaded_file.name)
|
| 12 |
+
os.makedirs("user_docs", exist_ok=True)
|
| 13 |
|
| 14 |
with open(save_path, "wb") as f:
|
| 15 |
+
f.write(uploaded_file.read())
|
| 16 |
|
| 17 |
+
st.session_state.pdf_path = save_path # ✅ Save for use in Q&A
|
| 18 |
+
st.success("✅ File uploaded and ready to use in PDF Q&A.")
|