ppsingh commited on
Commit
db65cd7
1 Parent(s): 023875f

Update appStore/tapp_display.py

Browse files
Files changed (1) hide show
  1. appStore/tapp_display.py +11 -8
appStore/tapp_display.py CHANGED
@@ -32,6 +32,7 @@ def targets():
32
  df = df.drop(df.filter(regex='Score').columns, axis=1)
33
  df = df[df.TargetLabel==True].reset_index(drop=True)
34
  df['keep'] = True
 
35
  st.session_state['target_hits'] = df
36
  st.session_state['netzero'] = netzero_placeholder
37
 
@@ -49,7 +50,7 @@ def target_display():
49
  count_netzero = sum(hits['NetzeroLabel'] == True)
50
  count_nonghg = sum(hits['NonGHGLabel'] == True)
51
  count_Mitigation = sum(hits['MitigationLabel'] == True)
52
- count_Adaptation = sum(hits['MitigationLabel'] == True)
53
 
54
 
55
  c1, c2 = st.columns([1,1])
@@ -60,13 +61,15 @@ def target_display():
60
  st.write('**GHG Target Related Paragraphs**: `{}`'.format(count_ghg))
61
  st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
62
  st.write('----------------')
63
-
64
- if count_netzero !=0:
65
- st.write("NetZero Target:",st.session_state['netzero'])
66
- else:
67
- st.info("🤔 No Netzero paragraph found")
68
- #st.dataframe(hits[['keep','text','Parameter','page']])
69
-
 
 
70
  st.dataframe(st.session_state['target_hits'])
71
  else:
72
  st.info("🤔 No Targets Found")
 
32
  df = df.drop(df.filter(regex='Score').columns, axis=1)
33
  df = df[df.TargetLabel==True].reset_index(drop=True)
34
  df['keep'] = True
35
+ df.drop(columns = ['ActionLabel','PolicyLabel','PlansLabel'], inplace=True)
36
  st.session_state['target_hits'] = df
37
  st.session_state['netzero'] = netzero_placeholder
38
 
 
50
  count_netzero = sum(hits['NetzeroLabel'] == True)
51
  count_nonghg = sum(hits['NonGHGLabel'] == True)
52
  count_Mitigation = sum(hits['MitigationLabel'] == True)
53
+ count_Adaptation = sum(hits['AdaptationLabel'] == True)
54
 
55
 
56
  c1, c2 = st.columns([1,1])
 
61
  st.write('**GHG Target Related Paragraphs**: `{}`'.format(count_ghg))
62
  st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
63
  st.write('----------------')
64
+ cols = list(hits.columns)
65
+ sector_cols = list(set(cols) - {'TargetLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel'})
66
+ placeholder= []
67
+ for col in sector_cols:
68
+ placeholder.append({'Sector':col,'Count':sum(df[col])})
69
+ sector_df = pd.DataFrame.from_dict(placeholder)
70
+ fig = px.bar(sector_df, x='Sector', y='Count')
71
+ st.plotly_chart(fig,use_container_width= True)
72
+
73
  st.dataframe(st.session_state['target_hits'])
74
  else:
75
  st.info("🤔 No Targets Found")