Spaces:
Sleeping
Sleeping
hotfix
Browse files
app.py
CHANGED
@@ -81,11 +81,13 @@ def process_text_file(file: AskFileResponse):
|
|
81 |
|
82 |
if suffix == ".txt":
|
83 |
file_loader = TextFileLoader(temp_file_path)
|
|
|
84 |
elif suffix == ".pdf":
|
85 |
file_loader = PDFLoader(temp_file_path)
|
|
|
86 |
else:
|
87 |
raise ValueError("Unsupported file type. Please upload a .txt or .pdf file.")
|
88 |
-
|
89 |
split_pages = []
|
90 |
for doc in documents:
|
91 |
split_pages += chunker.split_text(doc.page_content)
|
|
|
81 |
|
82 |
if suffix == ".txt":
|
83 |
file_loader = TextFileLoader(temp_file_path)
|
84 |
+
documents = file_loader.load_documents()
|
85 |
elif suffix == ".pdf":
|
86 |
file_loader = PDFLoader(temp_file_path)
|
87 |
+
documents = file_loader.load_and_split()
|
88 |
else:
|
89 |
raise ValueError("Unsupported file type. Please upload a .txt or .pdf file.")
|
90 |
+
|
91 |
split_pages = []
|
92 |
for doc in documents:
|
93 |
split_pages += chunker.split_text(doc.page_content)
|