Update appStore/tapp_display.py
Browse files- appStore/tapp_display.py +32 -26
appStore/tapp_display.py
CHANGED
@@ -38,9 +38,7 @@ def targets():
|
|
38 |
|
39 |
def target_display():
|
40 |
if 'key1' in st.session_state:
|
41 |
-
|
42 |
-
.format(os.path.basename(st.session_state['filename']),
|
43 |
-
len(st.session_state['key0'])))
|
44 |
|
45 |
hits = st.session_state['target_hits']
|
46 |
if len(hits) !=0:
|
@@ -53,6 +51,9 @@ def target_display():
|
|
53 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
54 |
|
55 |
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Target Related Paragraphs Statistics </h4>", unsafe_allow_html=True)
|
|
|
|
|
|
|
56 |
|
57 |
c1, c2 = st.columns([1,1])
|
58 |
with c1:
|
@@ -63,7 +64,7 @@ def target_display():
|
|
63 |
st.write('**GHG Target Related Paragraphs**: `{}`'.format(count_ghg))
|
64 |
st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
|
65 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
66 |
-
st.write('----------------')
|
67 |
|
68 |
|
69 |
|
@@ -97,10 +98,7 @@ def actions():
|
|
97 |
st.session_state['action_hits'] = df
|
98 |
|
99 |
def action_display():
|
100 |
-
if 'key1' in st.session_state:
|
101 |
-
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
102 |
-
.format(os.path.basename(st.session_state['filename']),
|
103 |
-
len(st.session_state['key0'])))
|
104 |
|
105 |
hits = st.session_state['action_hits']
|
106 |
if len(hits) !=0:
|
@@ -109,15 +107,18 @@ def action_display():
|
|
109 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
110 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
111 |
|
112 |
-
|
|
|
|
|
|
|
113 |
c1, c2 = st.columns([1,1])
|
114 |
with c1:
|
115 |
st.write('**Action Related Paragraphs**: `{}`'.format(count_action))
|
116 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
117 |
with c2:
|
118 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
119 |
-
st.write('----------------')
|
120 |
-
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Count </h4>", unsafe_allow_html=True)
|
121 |
cols = list(hits.columns)
|
122 |
sector_cols = list(set(cols) - {'ActionLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
123 |
sector_cols.sort()
|
@@ -129,6 +130,8 @@ def action_display():
|
|
129 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
130 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
131 |
st.plotly_chart(fig,use_container_width= True)
|
|
|
|
|
132 |
|
133 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
134 |
else:
|
@@ -147,9 +150,7 @@ def policy():
|
|
147 |
|
148 |
def policy_display():
|
149 |
if 'key1' in st.session_state:
|
150 |
-
|
151 |
-
.format(os.path.basename(st.session_state['filename']),
|
152 |
-
len(st.session_state['key0'])))
|
153 |
|
154 |
hits = st.session_state['policy_hits']
|
155 |
if len(hits) !=0:
|
@@ -157,16 +158,18 @@ def policy_display():
|
|
157 |
count_action = sum(hits['PolicyLabel'] == True)
|
158 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
159 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
160 |
-
|
161 |
-
|
|
|
|
|
162 |
c1, c2 = st.columns([1,1])
|
163 |
with c1:
|
164 |
st.write('**Policy Related Paragraphs**: `{}`'.format(count_action))
|
165 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
166 |
with c2:
|
167 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
168 |
-
st.write('----------------')
|
169 |
-
|
170 |
cols = list(hits.columns)
|
171 |
sector_cols = list(set(cols) - {'PolicyLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
172 |
sector_cols.sort()
|
@@ -177,7 +180,8 @@ def policy_display():
|
|
177 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
178 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
179 |
st.plotly_chart(fig,use_container_width= True)
|
180 |
-
|
|
|
181 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
182 |
else:
|
183 |
st.info("🤔 No Policy Found")
|
@@ -192,10 +196,7 @@ def plans():
|
|
192 |
st.session_state['plan_hits'] = df
|
193 |
|
194 |
def plans_display():
|
195 |
-
if 'key1' in st.session_state:
|
196 |
-
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
197 |
-
.format(os.path.basename(st.session_state['filename']),
|
198 |
-
len(st.session_state['key0'])))
|
199 |
|
200 |
hits = st.session_state['plan_hits']
|
201 |
if len(hits) !=0:
|
@@ -203,16 +204,19 @@ def plans_display():
|
|
203 |
count_action = sum(hits['PlansLabel'] == True)
|
204 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
205 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
206 |
-
|
207 |
|
|
|
|
|
|
|
|
|
208 |
c1, c2 = st.columns([1,1])
|
209 |
with c1:
|
210 |
st.write('**Plans Related Paragraphs**: `{}`'.format(count_action))
|
211 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
212 |
with c2:
|
213 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
214 |
-
st.write('----------------')
|
215 |
-
|
216 |
cols = list(hits.columns)
|
217 |
sector_cols = list(set(cols) - {'PlansLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
218 |
sector_cols.sort()
|
@@ -223,6 +227,8 @@ def plans_display():
|
|
223 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
224 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
225 |
st.plotly_chart(fig,use_container_width= True)
|
|
|
|
|
226 |
|
227 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
228 |
else:
|
|
|
38 |
|
39 |
def target_display():
|
40 |
if 'key1' in st.session_state:
|
41 |
+
|
|
|
|
|
42 |
|
43 |
hits = st.session_state['target_hits']
|
44 |
if len(hits) !=0:
|
|
|
51 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
52 |
|
53 |
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Target Related Paragraphs Statistics </h4>", unsafe_allow_html=True)
|
54 |
+
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
55 |
+
.format(os.path.basename(st.session_state['filename']),
|
56 |
+
len(st.session_state['key0'])))
|
57 |
|
58 |
c1, c2 = st.columns([1,1])
|
59 |
with c1:
|
|
|
64 |
st.write('**GHG Target Related Paragraphs**: `{}`'.format(count_ghg))
|
65 |
st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
|
66 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
67 |
+
#st.write('----------------')
|
68 |
|
69 |
|
70 |
|
|
|
98 |
st.session_state['action_hits'] = df
|
99 |
|
100 |
def action_display():
|
101 |
+
if 'key1' in st.session_state:
|
|
|
|
|
|
|
102 |
|
103 |
hits = st.session_state['action_hits']
|
104 |
if len(hits) !=0:
|
|
|
107 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
108 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
109 |
|
110 |
+
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Statistics </h4>", unsafe_allow_html=True)
|
111 |
+
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
112 |
+
.format(os.path.basename(st.session_state['filename']),
|
113 |
+
len(st.session_state['key0'])))
|
114 |
c1, c2 = st.columns([1,1])
|
115 |
with c1:
|
116 |
st.write('**Action Related Paragraphs**: `{}`'.format(count_action))
|
117 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
118 |
with c2:
|
119 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
120 |
+
#st.write('----------------')
|
121 |
+
#st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Count </h4>", unsafe_allow_html=True)
|
122 |
cols = list(hits.columns)
|
123 |
sector_cols = list(set(cols) - {'ActionLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
124 |
sector_cols.sort()
|
|
|
130 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
131 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
132 |
st.plotly_chart(fig,use_container_width= True)
|
133 |
+
st.write('------------------------')
|
134 |
+
st.write('Explore the data')
|
135 |
|
136 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
137 |
else:
|
|
|
150 |
|
151 |
def policy_display():
|
152 |
if 'key1' in st.session_state:
|
153 |
+
|
|
|
|
|
154 |
|
155 |
hits = st.session_state['policy_hits']
|
156 |
if len(hits) !=0:
|
|
|
158 |
count_action = sum(hits['PolicyLabel'] == True)
|
159 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
160 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
161 |
+
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Policy Related Paragraphs Statistics </h4>", unsafe_allow_html=True)
|
162 |
+
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
163 |
+
.format(os.path.basename(st.session_state['filename']),
|
164 |
+
len(st.session_state['key0'])))
|
165 |
c1, c2 = st.columns([1,1])
|
166 |
with c1:
|
167 |
st.write('**Policy Related Paragraphs**: `{}`'.format(count_action))
|
168 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
169 |
with c2:
|
170 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
171 |
+
#st.write('----------------')
|
172 |
+
|
173 |
cols = list(hits.columns)
|
174 |
sector_cols = list(set(cols) - {'PolicyLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
175 |
sector_cols.sort()
|
|
|
180 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
181 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
182 |
st.plotly_chart(fig,use_container_width= True)
|
183 |
+
st.write('-------------------')
|
184 |
+
st.write('Explore the data')
|
185 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
186 |
else:
|
187 |
st.info("🤔 No Policy Found")
|
|
|
196 |
st.session_state['plan_hits'] = df
|
197 |
|
198 |
def plans_display():
|
199 |
+
if 'key1' in st.session_state:
|
|
|
|
|
|
|
200 |
|
201 |
hits = st.session_state['plan_hits']
|
202 |
if len(hits) !=0:
|
|
|
204 |
count_action = sum(hits['PlansLabel'] == True)
|
205 |
count_mitigation = sum(hits['MitigationLabel'] == True)
|
206 |
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
|
|
207 |
|
208 |
+
st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Plans Related Paragraphs Statistics </h4>", unsafe_allow_html=True)
|
209 |
+
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
210 |
+
.format(os.path.basename(st.session_state['filename']),
|
211 |
+
len(st.session_state['key0'])))
|
212 |
c1, c2 = st.columns([1,1])
|
213 |
with c1:
|
214 |
st.write('**Plans Related Paragraphs**: `{}`'.format(count_action))
|
215 |
st.write('**Mitigation Related Paragraphs**: `{}`'.format(count_mitigation))
|
216 |
with c2:
|
217 |
st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
|
218 |
+
#st.write('----------------')
|
219 |
+
|
220 |
cols = list(hits.columns)
|
221 |
sector_cols = list(set(cols) - {'PlansLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
|
222 |
sector_cols.sort()
|
|
|
227 |
sector_df = pd.DataFrame.from_dict(placeholder)
|
228 |
fig = px.bar(sector_df, x='Sector', y='Count')
|
229 |
st.plotly_chart(fig,use_container_width= True)
|
230 |
+
st.write('---------------')
|
231 |
+
st.write('Explore the data')
|
232 |
|
233 |
st.dataframe(hits[['text','page','keep','MitigationLabel','AdaptationLabel','Sector']])
|
234 |
else:
|