angry-meow commited on
Commit
5aaa7d9
·
1 Parent(s): 3f2dc36

file loading testing

Browse files
Files changed (1) hide show
  1. helper_functions.py +2 -2
helper_functions.py CHANGED
@@ -12,7 +12,7 @@ import tempfile
12
  from chainlit.types import AskFileResponse
13
 
14
  def process_file(uploaded_file: AskFileResponse):
15
- if uploaded_file.endswith(".pdf"):
16
  with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".pdf") as temp_file:
17
  temp_file_path = temp_file.name
18
 
@@ -20,7 +20,7 @@ def process_file(uploaded_file: AskFileResponse):
20
  f.write(uploaded_file.content)
21
  # Load PDF with PyMuPDFLoader
22
  loader = PyMuPDFLoader(temp_file_path)
23
- elif uploaded_file.endswith(".txt"):
24
  with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as temp_file:
25
  temp_file_path = temp_file.name
26
 
 
12
  from chainlit.types import AskFileResponse
13
 
14
  def process_file(uploaded_file: AskFileResponse):
15
+ if uploaded_file.name.endswith(".pdf"):
16
  with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".pdf") as temp_file:
17
  temp_file_path = temp_file.name
18
 
 
20
  f.write(uploaded_file.content)
21
  # Load PDF with PyMuPDFLoader
22
  loader = PyMuPDFLoader(temp_file_path)
23
+ elif uploaded_file.name.endswith(".txt"):
24
  with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as temp_file:
25
  temp_file_path = temp_file.name
26