Skip to content

Commit 298fa94

Browse files
committed
fixed annotation's labels
1 parent 53436df commit 298fa94

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test2text/services/visualisation/visualize_vectors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DOT_SIZE_3D = 10
1414
LABELS_SUMMARY_LENGTH = 15
1515

16+
1617
def extract_annotation_vectors(db: DbClient):
1718
vectors = []
1819
embeddings = db.get_column_values("embedding", from_table="Annotations")
@@ -73,13 +74,13 @@ def minifold_vectors_3d(vectors: np.array):
7374
return vectors_3d
7475

7576

76-
def plot_vectors_2d(vectors_2d: np.array, title: str, labels: list=None):
77+
def plot_vectors_2d(vectors_2d: np.array, title: str, labels: list = None):
7778
fig = px.scatter(
7879
x=vectors_2d[:, 0],
7980
y=vectors_2d[:, 1],
8081
text=labels,
8182
)
82-
fig.update_traces(textposition='top center')
83+
fig.update_traces(textposition="top center")
8384
fig.update_layout(
8485
title=title,
8586
xaxis_title="X",
@@ -88,15 +89,15 @@ def plot_vectors_2d(vectors_2d: np.array, title: str, labels: list=None):
8889
st.plotly_chart(fig, use_container_width=True)
8990

9091

91-
def plot_vectors_3d(vectors_3d: np.array, title: str, labels: list=None):
92+
def plot_vectors_3d(vectors_3d: np.array, title: str, labels: list = None):
9293
fig = px.scatter_3d(
9394
x=vectors_3d[:, 0],
9495
y=vectors_3d[:, 1],
9596
z=vectors_3d[:, 2],
9697
color=vectors_3d[:, 2],
9798
text=labels,
9899
)
99-
fig.update_traces(textposition='top center')
100+
fig.update_traces(textposition="top center")
100101
fig.update_layout(title=title, xaxis_title="X", yaxis_title="Y")
101102
st.plotly_chart(fig, use_container_width=True)
102103

@@ -215,7 +216,6 @@ def visualize_vectors():
215216
progress_bar = st.progress(0)
216217

217218
annotation_vectors = extract_annotation_vectors(db)
218-
anno_labels = db.get_column_values("id", from_table="Annotations")
219219
progress_bar.progress(20, "Extracted")
220220
anno_vectors_2d = minifold_vectors_2d(annotation_vectors)
221221
progress_bar.progress(40, "Minifolded for 2D")

0 commit comments

Comments
 (0)