ZunairaHawwar commited on
Commit
b55f5ea
·
verified ·
1 Parent(s): 158ebca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -33,10 +33,12 @@ collection = chroma_client.get_or_create_collection(
33
  # --- Clear Collection ---
34
  def clear_collection():
35
  all_items = collection.get()
36
- if all_items and "ids" in all_items:
37
- collection.delete(ids=all_items["ids"])
38
- st.info(f"Cleared {len(all_items['ids'])} existing documents from ChromaDB.")
39
-
 
 
40
 
41
  # --- Ingest JSON Files from /docs/ ---
42
  def ingest_docs_to_chroma():
 
33
  # --- Clear Collection ---
34
  def clear_collection():
35
  all_items = collection.get()
36
+ ids = all_items.get("ids", [])
37
+ if ids:
38
+ collection.delete(ids=ids)
39
+ st.info(f"Cleared {len(ids)} existing documents from ChromaDB.")
40
+ else:
41
+ st.info("No documents to clear from ChromaDB.")
42
 
43
  # --- Ingest JSON Files from /docs/ ---
44
  def ingest_docs_to_chroma():