Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +18 -1
src/streamlit_app.py
CHANGED
|
@@ -37,4 +37,21 @@ st.altair_chart(alt.Chart(df, height=700, width=700)
|
|
| 37 |
y=alt.Y("y", axis=None),
|
| 38 |
color=alt.Color("idx", legend=None, scale=alt.Scale()),
|
| 39 |
size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
|
| 40 |
-
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
y=alt.Y("y", axis=None),
|
| 38 |
color=alt.Color("idx", legend=None, scale=alt.Scale()),
|
| 39 |
size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
|
| 40 |
+
))
|
| 41 |
+
|
| 42 |
+
from embedding_atlas.streamlit import embedding_atlas
|
| 43 |
+
from embedding_atlas.projection import compute_text_projection
|
| 44 |
+
|
| 45 |
+
df = pd.DataFrame({'projection_x': [1], 'projection_y': [1], 'description': ['x']})
|
| 46 |
+
|
| 47 |
+
# Compute text embedding and projection of the embedding
|
| 48 |
+
compute_text_projection(df, text="description",
|
| 49 |
+
x="projection_x", y="projection_y", neighbors="neighbors"
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Create an Embedding Atlas component for a given data frame
|
| 53 |
+
value = embedding_atlas(
|
| 54 |
+
df, text="description",
|
| 55 |
+
x="projection_x", y="projection_y", neighbors="neighbors",
|
| 56 |
+
show_table=True
|
| 57 |
+
)
|