captain-awesome commited on
Commit
f15d870
·
1 Parent(s): 04dab35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -381,12 +381,13 @@ def main():
381
  # Move the uploaded files to the temporary directory
382
  for uploaded_file in uploaded_files:
383
  uploaded_file.save(os.path.join(td, uploaded_file.name))
384
-
385
  # Process the files in the temporary directory
386
  for file in os.listdir(td):
387
  ext = os.path.splitext(file)[-1][1:].lower()
388
  if ext in FILE_LOADER_MAPPING:
389
  loader_class, loader_args = FILE_LOADER_MAPPING[ext]
 
 
390
  loader = loader_class(os.path.join(td, file), **loader_args)
391
  loaded_documents.extend(loader.load())
392
 
 
381
  # Move the uploaded files to the temporary directory
382
  for uploaded_file in uploaded_files:
383
  uploaded_file.save(os.path.join(td, uploaded_file.name))
 
384
  # Process the files in the temporary directory
385
  for file in os.listdir(td):
386
  ext = os.path.splitext(file)[-1][1:].lower()
387
  if ext in FILE_LOADER_MAPPING:
388
  loader_class, loader_args = FILE_LOADER_MAPPING[ext]
389
+ with open(os.path.join(td, file), 'wb') as temp_file:
390
+ temp_file.write(uploaded_file.read())
391
  loader = loader_class(os.path.join(td, file), **loader_args)
392
  loaded_documents.extend(loader.load())
393