Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing labels problem fixed #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions vectory/visualization/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from bokeh.plotting import figure
from streamlit_bokeh_events import streamlit_bokeh_events
from vectory.db.models import DatasetModel, EmbeddingSpaceModel
from vectory.es.utils import load_csv_with_headers
from vectory.visualization.utils import (
calculate_indices,
calculate_points,
Expand All @@ -24,11 +25,11 @@ def cached_calculate_points(model, embeddings, rows):
return calculate_points(model, embeddings, rows)


def selection(dataset):
def selection(dataset_query):
embedding_spaces = [
emb_space.name
for emb_space in EmbeddingSpaceModel.select().where(
EmbeddingSpaceModel.dataset == dataset
EmbeddingSpaceModel.dataset == dataset_query
)
]
selected_emb_space = st.selectbox(
Expand All @@ -41,7 +42,11 @@ def selection(dataset):
index = None
similarity = None
selected_vector = None
headers = []

dataset = next(iter(dataset_query))
_, _, headers = load_csv_with_headers(dataset.csv_path)
headers.remove("_idx")
headers.remove(str(dataset.id_field))

model = st.selectbox(
"Choose a model to use for embedding kNN search",
Expand Down Expand Up @@ -325,7 +330,8 @@ def main():
col1, col2 = st.columns(2)

if dataset is not None:
dataset = DatasetModel.select().where(DatasetModel.name == dataset)
dataset_query = DatasetModel.select().where(DatasetModel.name == dataset)

with col1:
(
dimensional_reduction_model_1,
Expand All @@ -337,7 +343,7 @@ def main():
selected_vector_1,
similarity_1,
embedding_space_1_name,
) = selection(dataset)
) = selection(dataset_query)
with col2:
(
dimensional_reduction_model_2,
Expand All @@ -349,7 +355,7 @@ def main():
selected_vector_2,
similarity_2,
embedding_space_2_name,
) = selection(dataset)
) = selection(dataset_query)

if "submit" not in st.session_state:
st.session_state.submit = False
Expand Down