Commit ·
2063af3
1
Parent(s): 644a030
Make points clickable
Browse files16 unmodified lines171819202122232461 unmodified lines868788899091929394959697989910010110210310410510610710810911016 unmodified lines@st.cache_resourcedef vector_compressor_from_config():'TODO'# return PCA(2)return UMAP(2)# Caching the dataframe since loading from external source can be time-consuming@st.cache_data61 unmodified linesclicked_point = selected_points[0]x_coord = x = clicked_point['x']y_coord = y = clicked_point['y']st.text(f"Embeddings shape: {embeddings.shape}")st.text(f"2dvector shapes shape: {vectors_2d.shape}")st.text(f"Clicked point coordinates: x = {x_coord}, y = {y_coord}")st.text("fOO")logging.info("Foo")inferred_embedding = reducer.inverse_transform(np.array([[x, y]]) if not isinstance(reducer, UMAP) else np.array([[x, y]]))logging.info("Bar")st.text("Bar")inferred_embedding = inferred_embedding.astype("float32")st.text("Bar")output = vec2text.invert_embeddings(embeddings=torch.tensor(inferred_embedding).cuda(),corrector=corrector,num_steps=20,)st.text("Bar")st.text(str(output))st.text(str(inferred_embedding))16 unmodified lines171819202122232461 unmodified lines868788899091929394959697989910010110216 unmodified lines@st.cache_resourcedef vector_compressor_from_config():'TODO'# return PCA(n:n_components=2)return UMAP(n_components=2)# Caching the dataframe since loading from external source can be time-consuming@st.cache_data61 unmodified linesclicked_point = selected_points[0]x_coord = x = clicked_point['x']y_coord = y = clicked_point['y']inferred_embedding = reducer.inverse_transform(np.array([[x, y]]) if not isinstance(reducer, UMAP) else np.array([[x, y]]))inferred_embedding = inferred_embedding.astype("float32")output = vec2text.invert_embeddings(embeddings=torch.tensor(inferred_embedding).cuda(),corrector=corrector,num_steps=20,)st.text(str(output))st.text(str(inferred_embedding))
app.py+4-12