Edit texts variable
Browse files
app.py
CHANGED
@@ -63,13 +63,13 @@ def process_text_file(file: AskFileResponse):
|
|
63 |
if file.type == 'text/plain':
|
64 |
text_loader = TextFileLoader(temp_file_path)
|
65 |
documents = text_loader.load_documents()
|
66 |
-
|
67 |
elif file.type == 'application/pdf':
|
68 |
pdf_reader = PdfReader(temp_file_path)
|
69 |
documents = [page.extract_text() for page in pdf_reader.pages]
|
70 |
else:
|
71 |
raise ValueError("Provide a .txt or .pdf file")
|
72 |
-
|
73 |
return texts
|
74 |
|
75 |
|
|
|
63 |
if file.type == 'text/plain':
|
64 |
text_loader = TextFileLoader(temp_file_path)
|
65 |
documents = text_loader.load_documents()
|
66 |
+
|
67 |
elif file.type == 'application/pdf':
|
68 |
pdf_reader = PdfReader(temp_file_path)
|
69 |
documents = [page.extract_text() for page in pdf_reader.pages]
|
70 |
else:
|
71 |
raise ValueError("Provide a .txt or .pdf file")
|
72 |
+
texts = text_splitter.split_texts(documents)
|
73 |
return texts
|
74 |
|
75 |
|