Update appStore/tapp_display.py
Browse files- appStore/tapp_display.py +15 -20
appStore/tapp_display.py
CHANGED
@@ -63,8 +63,12 @@ def target_display():
|
|
63 |
st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
|
64 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
65 |
st.write('----------------')
|
|
|
|
|
|
|
66 |
cols = list(hits.columns)
|
67 |
sector_cols = list(set(cols) - {'TargetLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
|
|
68 |
placeholder= []
|
69 |
for col in sector_cols:
|
70 |
placeholder.append({'Sector':col,'Count':sum(hits[col] == True)})
|
@@ -78,48 +82,39 @@ def target_display():
|
|
78 |
|
79 |
|
80 |
|
81 |
-
def
|
82 |
if 'key1' in st.session_state:
|
83 |
df = st.session_state['key1'].copy()
|
84 |
-
idx = df['NetzeroLabel_Score'].idxmax()
|
85 |
-
netzero_placeholder = df.loc[idx, 'text']
|
86 |
df = df.drop(df.filter(regex='Score').columns, axis=1)
|
87 |
-
df = df[df.
|
88 |
df['keep'] = True
|
89 |
-
df.drop(columns = ['
|
90 |
-
st.session_state['
|
91 |
-
st.session_state['netzero'] = netzero_placeholder
|
92 |
|
93 |
-
def
|
94 |
if 'key1' in st.session_state:
|
95 |
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
96 |
.format(os.path.basename(st.session_state['filename']),
|
97 |
len(st.session_state['key0'])))
|
98 |
|
99 |
-
hits = st.session_state['
|
100 |
if len(hits) !=0:
|
101 |
# collecting some statistics
|
102 |
-
|
103 |
-
count_ghg = sum(hits['GHGLabel'] == True)
|
104 |
-
count_netzero = sum(hits['NetzeroLabel'] == True)
|
105 |
-
count_nonghg = sum(hits['NonGHGLabel'] == True)
|
106 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
107 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
108 |
|
109 |
|
110 |
c1, c2 = st.columns([1,1])
|
111 |
with c1:
|
112 |
-
st.write('**
|
113 |
-
st.write('**Netzero Related Paragraphs**: `{}`'.format(count_netzero))
|
114 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
115 |
with c2:
|
116 |
-
st.write('**GHG Target Related Paragraphs**: `{}`'.format(count_ghg))
|
117 |
-
st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
|
118 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
119 |
st.write('----------------')
|
120 |
-
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral
|
121 |
cols = list(hits.columns)
|
122 |
-
sector_cols = list(set(cols) - {'
|
123 |
placeholder= []
|
124 |
for col in sector_cols:
|
125 |
placeholder.append({'Sector':col,'Count':sum(hits[col] == True)})
|
@@ -129,7 +124,7 @@ def target_display():
|
|
129 |
|
130 |
st.dataframe(hits)
|
131 |
else:
|
132 |
-
st.info("🤔 No
|
133 |
|
134 |
|
135 |
|
|
|
63 |
st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
|
64 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
65 |
st.write('----------------')
|
66 |
+
|
67 |
+
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Target Related Paragraphs Count </h4>", unsafe_allow_html=True)
|
68 |
+
|
69 |
cols = list(hits.columns)
|
70 |
sector_cols = list(set(cols) - {'TargetLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
71 |
+
|
72 |
placeholder= []
|
73 |
for col in sector_cols:
|
74 |
placeholder.append({'Sector':col,'Count':sum(hits[col] == True)})
|
|
|
82 |
|
83 |
|
84 |
|
85 |
+
def actions():
|
86 |
if 'key1' in st.session_state:
|
87 |
df = st.session_state['key1'].copy()
|
|
|
|
|
88 |
df = df.drop(df.filter(regex='Score').columns, axis=1)
|
89 |
+
df = df[df.ActionLabel==True].reset_index(drop=True)
|
90 |
df['keep'] = True
|
91 |
+
df.drop(columns = ['TargetLabel','PolicyLabel','PlansLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
|
92 |
+
st.session_state['action_hits'] = df
|
|
|
93 |
|
94 |
+
def action_display():
|
95 |
if 'key1' in st.session_state:
|
96 |
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
97 |
.format(os.path.basename(st.session_state['filename']),
|
98 |
len(st.session_state['key0'])))
|
99 |
|
100 |
+
hits = st.session_state['action_hits']
|
101 |
if len(hits) !=0:
|
102 |
# collecting some statistics
|
103 |
+
count_action = sum(hits['ActionLabel'] == True)
|
|
|
|
|
|
|
104 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
105 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
106 |
|
107 |
|
108 |
c1, c2 = st.columns([1,1])
|
109 |
with c1:
|
110 |
+
st.write('**Action Related Paragraphs**: `{}`'.format(count_action))
|
|
|
111 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
112 |
with c2:
|
|
|
|
|
113 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
114 |
st.write('----------------')
|
115 |
+
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Count </h4>", unsafe_allow_html=True)
|
116 |
cols = list(hits.columns)
|
117 |
+
sector_cols = list(set(cols) - {'ActionLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
118 |
placeholder= []
|
119 |
for col in sector_cols:
|
120 |
placeholder.append({'Sector':col,'Count':sum(hits[col] == True)})
|
|
|
124 |
|
125 |
st.dataframe(hits)
|
126 |
else:
|
127 |
+
st.info("🤔 No Actions Found")
|
128 |
|
129 |
|
130 |
|