Spaces:
Sleeping
Sleeping
Update apps/sdg_pd.py
Browse files- 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 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 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 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|