peter2000 commited on
Commit
f01d363
1 Parent(s): cee300d

Update apps/intro.py

Browse files
Files changed (1) hide show
  1. apps/intro.py +25 -1
apps/intro.py CHANGED
@@ -1 +1,25 @@
1
- import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import plotly.express as px
2
+ import streamlit as st
3
+ from sentence_transformers import SentenceTransformer
4
+ import umap.umap_ as umap
5
+ import pandas as pd
6
+ import os
7
+ import joblib
8
+
9
+
10
+ with st.container():
11
+ question = st.text_input("Please enter your text here and we will embed it for you.",
12
+ value="Woman",)
13
+
14
+ if st.button("Embed"):
15
+ with st.spinner("👑 load language model (sentence transformer)"):
16
+ model_name = 'sentence-transformers/all-MiniLM-L6-v2'
17
+ model = SentenceTransformer(model_name)
18
+ umap_name = "peter200/umap_embed_3d_all-MiniLM-L6-v2.sav"
19
+ umap_model = joblib.load(umap_name)
20
+ docs_umap = umap_model.transform(docs_embeddings)
21
+
22
+ examples_embeddings = model.encode(question)
23
+ examples_umap = umap_model.transform(examples_embeddings)
24
+
25
+ st.write(examples_umap.shape)