Spaces:
Runtime error
Runtime error
Adding load data function
Browse files
app.py
CHANGED
@@ -80,6 +80,18 @@ def load_file(file):
|
|
80 |
get_documents_in_db(),
|
81 |
)
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
def load_document(input_file):
|
85 |
file_name = input_file.name.split("/")[-1]
|
|
|
80 |
get_documents_in_db(),
|
81 |
)
|
82 |
|
83 |
+
def load_local_data(data_folder):
|
84 |
+
|
85 |
+
ids = chroma_collection.get()["ids"]
|
86 |
+
chroma_collection.delete(ids)
|
87 |
+
print('Cleaning DB')
|
88 |
+
|
89 |
+
for file in os.listdir(data_folder):
|
90 |
+
print('Adding file ' + file + ' to DB')
|
91 |
+
documents = loader.load_data(file= data_folder + file)
|
92 |
+
|
93 |
+
for doc in documents:
|
94 |
+
index.insert(doc)
|
95 |
|
96 |
def load_document(input_file):
|
97 |
file_name = input_file.name.split("/")[-1]
|