Spaces:
Sleeping
Sleeping
Update apps/intro.py
Browse files- apps/intro.py +7 -1
apps/intro.py
CHANGED
@@ -9,9 +9,13 @@ import joblib
|
|
9 |
|
10 |
def app():
|
11 |
word_to_embed_list = st.session_state['embed_list']
|
|
|
|
|
12 |
with st.container():
|
13 |
word_to_embed= st.text_input("Please enter your text here and we will embed it for you.",
|
14 |
value="Woman",)
|
|
|
|
|
15 |
|
16 |
if st.button("Embed"):
|
17 |
with st.spinner("π load language model (sentence transformer)"):
|
@@ -23,6 +27,8 @@ def app():
|
|
23 |
|
24 |
word_to_embed_list.append(word_to_embed)
|
25 |
st.session_state['embed_list'] = word_to_embed_list
|
|
|
|
|
26 |
|
27 |
examples_embeddings = model.encode(word_to_embed_list)
|
28 |
|
@@ -33,7 +39,7 @@ def app():
|
|
33 |
with st.spinner("π create visualisation"):
|
34 |
fig = px.scatter_3d(
|
35 |
examples_umap[1:] , x=0, y=1, z=2,
|
36 |
-
|
37 |
opacity = .7, hover_data=[word_to_embed_list[1:]])
|
38 |
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
|
39 |
fig.update_traces(marker_size=4)
|
|
|
9 |
|
10 |
def app():
|
11 |
word_to_embed_list = st.session_state['embed_list']
|
12 |
+
cat_list = st.session_state['cat_list']
|
13 |
+
|
14 |
with st.container():
|
15 |
word_to_embed= st.text_input("Please enter your text here and we will embed it for you.",
|
16 |
value="Woman",)
|
17 |
+
cat= st.selectbox('Categorie', ('1', '2', '3', '4', '5'))
|
18 |
+
|
19 |
|
20 |
if st.button("Embed"):
|
21 |
with st.spinner("π load language model (sentence transformer)"):
|
|
|
27 |
|
28 |
word_to_embed_list.append(word_to_embed)
|
29 |
st.session_state['embed_list'] = word_to_embed_list
|
30 |
+
cat_list .append(cat)
|
31 |
+
st.session_state['cat_list '] = cat_list
|
32 |
|
33 |
examples_embeddings = model.encode(word_to_embed_list)
|
34 |
|
|
|
39 |
with st.spinner("π create visualisation"):
|
40 |
fig = px.scatter_3d(
|
41 |
examples_umap[1:] , x=0, y=1, z=2,
|
42 |
+
color=cat_list[1:] ,
|
43 |
opacity = .7, hover_data=[word_to_embed_list[1:]])
|
44 |
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
|
45 |
fig.update_traces(marker_size=4)
|