Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,7 +61,6 @@ if 'words_umap_df' not in st.session_state:
|
|
61 |
"l": "Secret word"
|
62 |
}
|
63 |
|
64 |
-
words_umap_df = st.session_state['words_umap_df']
|
65 |
|
66 |
st.write('Try to guess a secret word by semantic similarity')
|
67 |
|
@@ -79,7 +78,7 @@ if st.button("Guess") or word:
|
|
79 |
st.session_state['words'].append((str(word), similarity))
|
80 |
|
81 |
pt = umap_3d.transform([word_embedding])[0]
|
82 |
-
words_umap_df.loc[len(words_umap_df)] = {
|
83 |
"x": pt[0],
|
84 |
"y": pt[1],
|
85 |
"z": pt[2],
|
@@ -95,5 +94,5 @@ words_df = pd.DataFrame(
|
|
95 |
st.dataframe(words_df, use_container_width=True)
|
96 |
|
97 |
|
98 |
-
fig_3d = px.scatter_3d(words_umap_df, x="x", y="y", z="z", color="similarity", hover_name="l", hover_data={"x": False, "y": False, "z": False, "s": False}, size="s", size_max=10, range_color=(0,1))
|
99 |
st.plotly_chart(fig_3d, theme="streamlit", use_container_width=True)
|
|
|
61 |
"l": "Secret word"
|
62 |
}
|
63 |
|
|
|
64 |
|
65 |
st.write('Try to guess a secret word by semantic similarity')
|
66 |
|
|
|
78 |
st.session_state['words'].append((str(word), similarity))
|
79 |
|
80 |
pt = umap_3d.transform([word_embedding])[0]
|
81 |
+
st.session_state['words_umap_df'].loc[len(st.session_state['words_umap_df'])] = {
|
82 |
"x": pt[0],
|
83 |
"y": pt[1],
|
84 |
"z": pt[2],
|
|
|
94 |
st.dataframe(words_df, use_container_width=True)
|
95 |
|
96 |
|
97 |
+
fig_3d = px.scatter_3d(st.session_state['words_umap_df'], x="x", y="y", z="z", color="similarity", hover_name="l", hover_data={"x": False, "y": False, "z": False, "s": False}, size="s", size_max=10, range_color=(0,1))
|
98 |
st.plotly_chart(fig_3d, theme="streamlit", use_container_width=True)
|