Spaces:
Sleeping
Sleeping
Commit
·
fc71dc0
1
Parent(s):
b325b66
Fixes process function name
Browse files
app.py
CHANGED
|
@@ -73,8 +73,8 @@ def process_pdf_file(file: AskFileResponse):
|
|
| 73 |
with open(temp_file_path, "wb") as f:
|
| 74 |
f.write(file.content)
|
| 75 |
|
| 76 |
-
|
| 77 |
-
documents =
|
| 78 |
texts = text_splitter.split_texts(documents)
|
| 79 |
return texts
|
| 80 |
|
|
@@ -100,9 +100,9 @@ async def on_chat_start():
|
|
| 100 |
|
| 101 |
# load the file
|
| 102 |
if file.path.endswith(".pdf"):
|
| 103 |
-
texts = process_text_file(file)
|
| 104 |
-
else:
|
| 105 |
texts = process_pdf_file(file)
|
|
|
|
|
|
|
| 106 |
|
| 107 |
print(f"Processing {len(texts)} text chunks")
|
| 108 |
|
|
|
|
| 73 |
with open(temp_file_path, "wb") as f:
|
| 74 |
f.write(file.content)
|
| 75 |
|
| 76 |
+
pdf_loader = PDFFileLoader(temp_file_path)
|
| 77 |
+
documents = pdf_loader.load_documents()
|
| 78 |
texts = text_splitter.split_texts(documents)
|
| 79 |
return texts
|
| 80 |
|
|
|
|
| 100 |
|
| 101 |
# load the file
|
| 102 |
if file.path.endswith(".pdf"):
|
|
|
|
|
|
|
| 103 |
texts = process_pdf_file(file)
|
| 104 |
+
else:
|
| 105 |
+
texts = process_text_file(file)
|
| 106 |
|
| 107 |
print(f"Processing {len(texts)} text chunks")
|
| 108 |
|