Spaces:
Sleeping
Sleeping
Update create_database.py
Browse files- create_database.py +3 -1
create_database.py
CHANGED
@@ -19,7 +19,9 @@ def create_database(txt):
|
|
19 |
chromadb.api.client.SharedSystemClient.clear_system_cache()
|
20 |
|
21 |
chroma_cli = chromadb.Client()
|
22 |
-
|
|
|
|
|
23 |
collection = chroma_cli.create_collection("chat-with-docs",embedding_function=embedding_fn)
|
24 |
|
25 |
txt = split_list(txt,5000)
|
|
|
19 |
chromadb.api.client.SharedSystemClient.clear_system_cache()
|
20 |
|
21 |
chroma_cli = chromadb.Client()
|
22 |
+
existing_collections = [collection.name for collection in client.list_collections()]
|
23 |
+
if "chat-with-docs" in existing_collections:
|
24 |
+
chroma_cli.delete_collection(name="chat-with-docs")
|
25 |
collection = chroma_cli.create_collection("chat-with-docs",embedding_function=embedding_fn)
|
26 |
|
27 |
txt = split_list(txt,5000)
|