collection-manager / pages /create_or_delete_kb.py
marcellopoliti's picture
update requirements
02b71a7
import streamlit as st
from retrieve_kb import get_current_knowledge_bases
from app import client, show_sidebar
from utils import get_chroma_client
st.title("Delete knowledge Base ☠️")
show_sidebar()
kbs = get_current_knowledge_bases(client=client)
kbs = sorted(kb.name for kb in kbs)
collection_name = st.selectbox("Select knowledge box to delete", kbs)
if st.button("Delete Forever"):
try:
client.delete_collection(collection_name)
st.success("Deleted")
except Exception as e:
st.error(f"{str(e)}")
st.experimental_rerun()
# Title of the app
st.title("Create a knowledge box")
show_sidebar()
collection_name = st.text_input(label="empy collection name")
if st.button("create empty knowledge box"):
try:
client = get_chroma_client()
collection = client.create_collection(name=collection_name)
st.success(f"collection {collection_name} created")
except Exception as e:
st.error(f"{str(e)}")
st.experimental_rerun()