peter2000 commited on
Commit
ed07ef7
β€’
1 Parent(s): 7bb4c3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -13,6 +13,7 @@ with st.spinner("πŸ‘‘ load language model (sentence transformer)"):
13
 
14
  with st.spinner("πŸ‘‘ load sdg data"):
15
  df_osdg = pd.read_csv('https://zenodo.org/record/5550238/files/osdg-community-dataset-v21-09-30.csv',sep='\t')
 
16
 
17
  _lab_dict = {0: 'no_cat',
18
  1:'SDG 1 - No poverty',
@@ -38,7 +39,7 @@ with st.spinner("πŸ‘‘ load sdg data"):
38
  docs = list(df_osdg['text'])
39
  docs_embeddings = model.encode(docs)
40
 
41
- with st.spinner("πŸ‘‘ create visualisation"):
42
  n_neighbors = 15
43
  n_components = 3
44
  random_state =42
@@ -49,7 +50,8 @@ with st.spinner("πŸ‘‘ create visualisation"):
49
  .fit(docs_embeddings))
50
 
51
  docs_umap = umap_model.transform(docs_embeddings)
52
-
 
53
  fig = px.scatter_3d(
54
  docs_umap, x=0, y=1, z=2,
55
  color=labels,
 
13
 
14
  with st.spinner("πŸ‘‘ load sdg data"):
15
  df_osdg = pd.read_csv('https://zenodo.org/record/5550238/files/osdg-community-dataset-v21-09-30.csv',sep='\t')
16
+ df_osdg = df_osdg[:1000]
17
 
18
  _lab_dict = {0: 'no_cat',
19
  1:'SDG 1 - No poverty',
 
39
  docs = list(df_osdg['text'])
40
  docs_embeddings = model.encode(docs)
41
 
42
+ with st.spinner("πŸ‘‘ prepare visualisation"):
43
  n_neighbors = 15
44
  n_components = 3
45
  random_state =42
 
50
  .fit(docs_embeddings))
51
 
52
  docs_umap = umap_model.transform(docs_embeddings)
53
+
54
+ with st.spinner("πŸ‘‘ create visualisation"):
55
  fig = px.scatter_3d(
56
  docs_umap, x=0, y=1, z=2,
57
  color=labels,