Spaces:
Running
Running
Update apps/intro.py
Browse files- apps/intro.py +14 -8
apps/intro.py
CHANGED
@@ -18,13 +18,19 @@ def app():
|
|
18 |
model = SentenceTransformer(model_name)
|
19 |
REPO_ID = "peter2000/umap_embed_3d_all-MiniLM-L6-v2"
|
20 |
FILENAME = "umap_embed_3d_all-MiniLM-L6-v2.sav"
|
21 |
-
|
22 |
-
|
23 |
-
st.write("embed umap")
|
24 |
-
|
25 |
-
|
26 |
examples_embeddings = model.encode(question)
|
27 |
-
|
28 |
-
examples_umap =
|
29 |
|
30 |
-
st.write(len(examples_umap))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
model = SentenceTransformer(model_name)
|
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 |
examples_embeddings = model.encode(question)
|
24 |
+
|
25 |
+
examples_umap = umap_model.transform(examples_embeddings)
|
26 |
|
27 |
+
#st.write(len(examples_umap))
|
28 |
+
|
29 |
+
with st.spinner("👑 create visualisation"):
|
30 |
+
fig = px.scatter_3d(
|
31 |
+
examples_umap , x=0, y=1, z=2,
|
32 |
+
# color='labels',
|
33 |
+
opacity = .5, hover_data=[question])
|
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)
|