peter2000 commited on
Commit
c06e027
1 Parent(s): 0088b2f

Update apps/intro.py

Browse files
Files changed (1) hide show
  1. apps/intro.py +5 -2
apps/intro.py CHANGED
@@ -1,6 +1,7 @@
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
@@ -15,8 +16,10 @@ def app():
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 = "peter2000/umap_embed_3d_all-MiniLM-L6-v2"
19
- umap_model = joblib.load(umap_name)
 
 
20
  docs_umap = umap_model.transform(docs_embeddings)
21
 
22
  examples_embeddings = model.encode(question)
 
1
  import plotly.express as px
2
  import streamlit as st
3
  from sentence_transformers import SentenceTransformer
4
+ from huggingface_hub import hf_hub_url, cached_download
5
  import umap.umap_ as umap
6
  import pandas as pd
7
  import os
 
16
  with st.spinner("👑 load language model (sentence transformer)"):
17
  model_name = 'sentence-transformers/all-MiniLM-L6-v2'
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
+ model_umap = joblib.load(cached_download(hf_hub_url(REPO_ID, FILENAME)))
22
+
23
  docs_umap = umap_model.transform(docs_embeddings)
24
 
25
  examples_embeddings = model.encode(question)