Spaces:
Paused
Paused
Commit
·
4115710
1
Parent(s):
26e0da2
file loading testing
Browse files- helper_functions.py +2 -2
helper_functions.py
CHANGED
@@ -20,7 +20,7 @@ def store_uploaded_file(uploaded_file: AskFileResponse):
|
|
20 |
return temp_file_path
|
21 |
|
22 |
def process_file(uploaded_file: AskFileResponse):
|
23 |
-
if uploaded_file.
|
24 |
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".pdf") as temp_file:
|
25 |
temp_file_path = temp_file.name
|
26 |
|
@@ -28,7 +28,7 @@ def process_file(uploaded_file: AskFileResponse):
|
|
28 |
f.write(uploaded_file.content)
|
29 |
# Load PDF with PyMuPDFLoader
|
30 |
loader = PyMuPDFLoader(temp_file_path)
|
31 |
-
elif uploaded_file.
|
32 |
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as temp_file:
|
33 |
temp_file_path = temp_file.name
|
34 |
|
|
|
20 |
return temp_file_path
|
21 |
|
22 |
def process_file(uploaded_file: AskFileResponse):
|
23 |
+
if uploaded_file.endswith(".pdf"):
|
24 |
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".pdf") as temp_file:
|
25 |
temp_file_path = temp_file.name
|
26 |
|
|
|
28 |
f.write(uploaded_file.content)
|
29 |
# Load PDF with PyMuPDFLoader
|
30 |
loader = PyMuPDFLoader(temp_file_path)
|
31 |
+
elif uploaded_file.endswith(".txt"):
|
32 |
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as temp_file:
|
33 |
temp_file_path = temp_file.name
|
34 |
|