Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ def load_data():
|
|
23 |
data_on_pdf = loader.load()
|
24 |
text_splitter = RecursiveCharacterTextSplitter(
|
25 |
separators=["\n\n", "\n", ". ", " ", ""],
|
26 |
-
chunk_size=
|
27 |
chunk_overlap=200
|
28 |
)
|
29 |
splits = text_splitter.split_documents(data_on_pdf)
|
@@ -39,17 +39,6 @@ vectorstore = load_data()
|
|
39 |
# Streamlit interface
|
40 |
st.title("RAG App: Question-Answering with PDFs")
|
41 |
|
42 |
-
# File uploader for PDF documents
|
43 |
-
uploaded_files = st.file_uploader("Upload PDF files", accept_multiple_files=True, type=["pdf"])
|
44 |
-
|
45 |
-
if uploaded_files:
|
46 |
-
for uploaded_file in uploaded_files:
|
47 |
-
with open(os.path.join(DATA_DIR, uploaded_file.name), "wb") as f:
|
48 |
-
f.write(uploaded_file.getbuffer())
|
49 |
-
st.success("PDF files uploaded successfully!")
|
50 |
-
|
51 |
-
# Reload vector store after uploading new files
|
52 |
-
vectorstore = load_data()
|
53 |
|
54 |
# User input for question
|
55 |
question = st.text_input("Ask a question about the documents:")
|
|
|
23 |
data_on_pdf = loader.load()
|
24 |
text_splitter = RecursiveCharacterTextSplitter(
|
25 |
separators=["\n\n", "\n", ". ", " ", ""],
|
26 |
+
chunk_size=2000,
|
27 |
chunk_overlap=200
|
28 |
)
|
29 |
splits = text_splitter.split_documents(data_on_pdf)
|
|
|
39 |
# Streamlit interface
|
40 |
st.title("RAG App: Question-Answering with PDFs")
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
# User input for question
|
44 |
question = st.text_input("Ask a question about the documents:")
|