peter2000 commited on
Commit
9c68e6b
Β·
1 Parent(s): 4a03159

Update apps/sdg_pd.py

Browse files
Files changed (1) hide show
  1. apps/sdg_pd.py +24 -21
apps/sdg_pd.py CHANGED
@@ -9,26 +9,29 @@ def app():
9
  st.title("SDG Embedding Visualisation")
10
 
11
  with st.spinner("πŸ‘‘ load data"):
12
- df_osdg = pd.read_csv("sdg_umap.csv", sep = "|")
13
-
14
- #labels = [_lab_dict[lab] for lab in df_osdg['label'] ]
15
- keys = list(df_osdg['keys'])
16
- #docs = list(df_osdg['text'])
 
 
17
 
18
- with st.spinner("πŸ‘‘ create visualisation"):
19
- fig = px.scatter_3d(
20
- df_osdg, x='coord_x', y='coord_y', z='coord_z',
21
- opacity = .5, hover_data=[keys])
22
- fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
23
- fig.update_traces(marker_size=4)
24
- st.plotly_chart(fig)
25
 
26
- if st.button("Embed"):
27
- with st.spinner("πŸ‘‘ create visualisation"):
28
- fig = px.scatter_3d(
29
- df_osdg, x='coord_x', y='coord_y', z='coord_z',
30
- color='labels',
31
- opacity = .5, hover_data=[keys])
32
- fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
33
- fig.update_traces(marker_size=4)
34
- st.plotly_chart(fig)
 
 
 
 
 
 
 
 
9
  st.title("SDG Embedding Visualisation")
10
 
11
  with st.spinner("πŸ‘‘ load data"):
12
+ df_osdg = pd.read_csv("sdg_umap.csv", sep = "|")
13
+
14
+ #labels = [_lab_dict[lab] for lab in df_osdg['label'] ]
15
+ keys = list(df_osdg['keys'])
16
+ #docs = list(df_osdg['text'])
17
+
18
+ agree = st.checkbox('add labels')
19
 
20
+ if agree:
 
 
 
 
 
 
21
 
22
+ with st.spinner("πŸ‘‘ create visualisation"):
23
+ fig = px.scatter_3d(
24
+ df_osdg, x='coord_x', y='coord_y', z='coord_z',
25
+ color='labels',
26
+ opacity = .5, hover_data=[keys])
27
+ fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
28
+ fig.update_traces(marker_size=4)
29
+ st.plotly_chart(fig)
30
+ else:
31
+ with st.spinner("πŸ‘‘ create visualisation"):
32
+ fig = px.scatter_3d(
33
+ df_osdg, x='coord_x', y='coord_y', z='coord_z',
34
+ opacity = .5, hover_data=[keys])
35
+ fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
36
+ fig.update_traces(marker_size=4)
37
+ st.plotly_chart(fig)