Skip to content

Instantly share code, notes, and snippets.

@GeorgePearse
Created August 16, 2022 19:08
Show Gist options
  • Select an option

  • Save GeorgePearse/41b41609a56a6ead86800a76ac4e4d79 to your computer and use it in GitHub Desktop.

Select an option

Save GeorgePearse/41b41609a56a6ead86800a76ac4e4d79 to your computer and use it in GitHub Desktop.
import streamlit as st
import os
import requests
vector_db_host = os.environ.get('VECTOR_DB_HOST')
# queries the DB to get the options
collections = [
record["name"]
for record in requests.get(f"{vector_db_host}/collections").json()["result"][
"collections"
]
]
with st.form(key="my_form"):
collection_name = st.selectbox("collection", collections)
submitted = st.form_submit_button(label="Delete")
# prevents submission so that you don't accidentally delete
# a collection
if submitted:
response = requests.delete(
f"{vector_db_host}/collections/{collection_name}"
).json()
st.json(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment