Spaces:
Sleeping
Sleeping
Create new file
Browse files- apps/sdg_pd.py +25 -0
apps/sdg_pd.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
7 |
+
|
8 |
+
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='cood_x', y='cood_y', z='cood_z',
|
21 |
+
color='labels',
|
22 |
+
opacity = .5, hover_data="keys")
|
23 |
+
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,zaxis_visible=False )
|
24 |
+
fig.update_traces(marker_size=4)
|
25 |
+
st.plotly_chart(fig)
|