Spaces:
Running
Running
Update apps/intro.py
Browse files- apps/intro.py +6 -4
apps/intro.py
CHANGED
@@ -8,8 +8,9 @@ import os
|
|
8 |
import joblib
|
9 |
|
10 |
def app():
|
|
|
11 |
with st.container():
|
12 |
-
|
13 |
value="Woman",)
|
14 |
|
15 |
if st.button("Embed"):
|
@@ -19,8 +20,9 @@ def app():
|
|
19 |
REPO_ID = "peter2000/umap_embed_3d_all-MiniLM-L6-v2"
|
20 |
FILENAME = "umap_embed_3d_all-MiniLM-L6-v2.sav"
|
21 |
umap_model= joblib.load(cached_download(hf_hub_url(REPO_ID, FILENAME)))
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
examples_umap = umap_model.transform(examples_embeddings)
|
26 |
|
@@ -30,7 +32,7 @@ def app():
|
|
30 |
fig = px.scatter_3d(
|
31 |
examples_umap , x=0, y=1, z=2,
|
32 |
# color='labels',
|
33 |
-
opacity = .5, hover_data=[
|
34 |
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
|
35 |
fig.update_traces(marker_size=4)
|
36 |
st.plotly_chart(fig)
|
|
|
8 |
import joblib
|
9 |
|
10 |
def app():
|
11 |
+
word_to_embed_list = ["first"]
|
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"):
|
|
|
20 |
REPO_ID = "peter2000/umap_embed_3d_all-MiniLM-L6-v2"
|
21 |
FILENAME = "umap_embed_3d_all-MiniLM-L6-v2.sav"
|
22 |
umap_model= joblib.load(cached_download(hf_hub_url(REPO_ID, FILENAME)))
|
23 |
+
|
24 |
+
word_to_embed_list.append(word_to_embed)
|
25 |
+
examples_embeddings = model.encode(word_to_embed_list)
|
26 |
|
27 |
examples_umap = umap_model.transform(examples_embeddings)
|
28 |
|
|
|
32 |
fig = px.scatter_3d(
|
33 |
examples_umap , x=0, y=1, z=2,
|
34 |
# color='labels',
|
35 |
+
opacity = .5, hover_data=[word_to_embed_list])
|
36 |
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
|
37 |
fig.update_traces(marker_size=4)
|
38 |
st.plotly_chart(fig)
|