captain-awesome commited on
Commit
34e4c94
·
1 Parent(s): d9cdba3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -373,12 +373,14 @@ def main():
373
  loader_class, loader_args = FILE_LOADER_MAPPING[ext]
374
  st.write(f"loader_class: {loader_class}")
375
  # Save the uploaded file to the temporary directory
376
- file_path = os.path.join(td, uploaded_file.name)
377
- with open(file_path, 'wb') as temp_file:
378
  temp_file.write(uploaded_file.read())
 
 
379
 
380
  # Use Langchain loader to process the file
381
- loader = loader_class(file_path, **loader_args)
382
  loaded_documents.extend(loader.load())
383
  st.write(f"loaded_documents: {loaded_documents}")
384
 
 
373
  loader_class, loader_args = FILE_LOADER_MAPPING[ext]
374
  st.write(f"loader_class: {loader_class}")
375
  # Save the uploaded file to the temporary directory
376
+ # file_path = os.path.join(td, uploaded_file.name)
377
+ with open(os.path.join(td, uploaded_file), 'wb') as temp_file:
378
  temp_file.write(uploaded_file.read())
379
+ # with open(file_path, 'wb') as temp_file:
380
+ # temp_file.write(uploaded_file.read())
381
 
382
  # Use Langchain loader to process the file
383
+ loader = loader_class(os.path.join(td, file), **loader_args)
384
  loaded_documents.extend(loader.load())
385
  st.write(f"loaded_documents: {loaded_documents}")
386