Spaces:
GIZ
/
Running on CPU Upgrade

prashant commited on
Commit
62fb673
1 Parent(s): f9b5e7f

pie chart fix

Browse files
appStore/sdg_analysis.py CHANGED
@@ -129,16 +129,18 @@ def app():
129
  fig, ax = plt.subplots()
130
  ax.pie(x['count'], colors=colors, radius=2, center=(4, 4),
131
  wedgeprops={"linewidth": 1, "edgecolor": "white"},
132
- frame=False,labels =list(x.SDG_name))
133
  # fig.savefig('temp.png', bbox_inches='tight',dpi= 100)
134
 
135
 
136
  st.markdown("#### Anything related to SDGs? ####")
137
 
138
- c4, c5, c6 = st.columns([2, 2, 2])
139
 
140
  with c5:
141
  st.pyplot(fig)
 
 
142
 
143
  st.markdown("###### What keywords are present under SDG classified text? ######")
144
 
@@ -147,7 +149,8 @@ def app():
147
  # st.table(tRkeywordsDf)
148
  AgGrid(tRkeywordsDf, reload_data = False,
149
  update_mode="value_changed",
150
- columns_auto_size_mode = ColumnsAutoSizeMode.FIT_CONTENTS )
 
151
 
152
  st.markdown("###### Top few SDG Classified paragraph/text results ######")
153
  # c7, c8, c9 = st.columns([1, 10, 1])
 
129
  fig, ax = plt.subplots()
130
  ax.pie(x['count'], colors=colors, radius=2, center=(4, 4),
131
  wedgeprops={"linewidth": 1, "edgecolor": "white"},
132
+ frame=False,labels =list(x.SDG))
133
  # fig.savefig('temp.png', bbox_inches='tight',dpi= 100)
134
 
135
 
136
  st.markdown("#### Anything related to SDGs? ####")
137
 
138
+ c4, c5, c6 = st.columns([1, 5, 2])
139
 
140
  with c5:
141
  st.pyplot(fig)
142
+ with c6:
143
+ st.table(x[['SDG','SDG_name']])
144
 
145
  st.markdown("###### What keywords are present under SDG classified text? ######")
146
 
 
149
  # st.table(tRkeywordsDf)
150
  AgGrid(tRkeywordsDf, reload_data = False,
151
  update_mode="value_changed",
152
+ columns_auto_size_mode = ColumnsAutoSizeMode.FIT_CONTENTS,
153
+ height = 100 )
154
 
155
  st.markdown("###### Top few SDG Classified paragraph/text results ######")
156
  # c7, c8, c9 = st.columns([1, 10, 1])
utils/sdg_classifier.py CHANGED
@@ -97,6 +97,7 @@ def sdg_classification(haystackdoc:List[Document])->Tuple[DataFrame,Series]:
97
  x = x.rename_axis('SDG').reset_index()
98
  x["SDG"] = pd.to_numeric(x["SDG"])
99
  x['SDG_name'] = x['SDG'].apply(lambda x: _lab_dict[x])
 
100
  df= df.drop(['Relevancy'], axis = 1)
101
 
102
 
 
97
  x = x.rename_axis('SDG').reset_index()
98
  x["SDG"] = pd.to_numeric(x["SDG"])
99
  x['SDG_name'] = x['SDG'].apply(lambda x: _lab_dict[x])
100
+ x['SDG'] = x['SDG'].apply(lambda x: "SDG "+str(x))
101
  df= df.drop(['Relevancy'], axis = 1)
102
 
103