File size: 996 Bytes
f01d363
 
 
 
 
 
 
 
0eb8992
 
f01d363
 
 
 
 
 
 
0088b2f
f01d363
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import plotly.express as px
import streamlit as st
from sentence_transformers import SentenceTransformer
import umap.umap_ as umap
import pandas as pd
import os
import joblib

def app():
    with st.container():
        question = st.text_input("Please enter your text here and we will embed it for you.",
                                         value="Woman",)
        
        if st.button("Embed"):
            with st.spinner("👑 load language model (sentence transformer)"):
                model_name = 'sentence-transformers/all-MiniLM-L6-v2'
                model = SentenceTransformer(model_name)
                umap_name = "peter2000/umap_embed_3d_all-MiniLM-L6-v2"
                umap_model = joblib.load(umap_name)
                docs_umap = umap_model.transform(docs_embeddings)
                
                examples_embeddings = model.encode(question)
                examples_umap = umap_model.transform(examples_embeddings)

                st.write(examples_umap.shape)