Update app.py
Browse files
app.py
CHANGED
@@ -72,10 +72,11 @@ def load_documents(file_objs):
|
|
72 |
documents = []
|
73 |
document_names = []
|
74 |
for file_obj in file_objs:
|
75 |
-
|
|
|
76 |
loaded_docs = SimpleDirectoryReader(input_files=[file_obj.name]).load_data()
|
77 |
for doc in loaded_docs:
|
78 |
-
doc.metadata["source"] =
|
79 |
documents.append(doc)
|
80 |
|
81 |
if not documents:
|
|
|
72 |
documents = []
|
73 |
document_names = []
|
74 |
for file_obj in file_objs:
|
75 |
+
file_name = os.path.basename(file_obj.name)
|
76 |
+
document_names.append(file_name)
|
77 |
loaded_docs = SimpleDirectoryReader(input_files=[file_obj.name]).load_data()
|
78 |
for doc in loaded_docs:
|
79 |
+
doc.metadata["source"] = file_name
|
80 |
documents.append(doc)
|
81 |
|
82 |
if not documents:
|