target check
Browse files- appStore/target.py +63 -62
appStore/target.py
CHANGED
@@ -104,72 +104,73 @@ def target_display():
|
|
104 |
|
105 |
|
106 |
hits = df[df['Target Label'] == 'TARGET']
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
|
174 |
-
else:
|
175 |
-
|
|
|
104 |
|
105 |
|
106 |
hits = df[df['Target Label'] == 'TARGET']
|
107 |
+
st.table(hits)
|
108 |
+
# # hits['GHG Label'] = hits['GHG Label'].apply(lambda i: _lab_dict[i])
|
109 |
+
# range_val = min(5,len(hits))
|
110 |
+
# if range_val !=0:
|
111 |
+
# count_target = sum(hits['Target Label'] == 'TARGET')
|
112 |
+
# count_netzero = sum(hits['Netzero Label'] == 'NETZERO')
|
113 |
+
# count_ghg = sum(hits['GHG Label'] == 'GHG')
|
114 |
+
# count_economy = sum([True if 'Economy-wide' in x else False
|
115 |
+
# for x in hits['Sector Label']])
|
116 |
|
117 |
+
# # count_df = df['Target Label'].value_counts()
|
118 |
+
# # count_df = count_df.rename('count')
|
119 |
+
# # count_df = count_df.rename_axis('Target Label').reset_index()
|
120 |
+
# # count_df['Label_def'] = count_df['Target Label'].apply(lambda x: _lab_dict[x])
|
121 |
|
122 |
+
# # fig = px.bar(count_df, y="Label_def", x="count", orientation='h', height=200)
|
123 |
+
# c1, c2 = st.columns([1,1])
|
124 |
+
# with c1:
|
125 |
+
# st.write('**Target Paragraphs**: `{}`'.format(count_target))
|
126 |
+
# st.write('**NetZero Related Paragraphs**: `{}`'.format(count_netzero))
|
127 |
|
128 |
+
# # st.plotly_chart(fig,use_container_width= True)
|
129 |
|
130 |
+
# # count_netzero = sum(hits['Netzero Label'] == 'NETZERO')
|
131 |
+
# # count_ghg = sum(hits['GHG Label'] == 'LABEL_2')
|
132 |
+
# # count_economy = sum([True if 'Economy-wide' in x else False
|
133 |
+
# # for x in hits['Sector Label']])
|
134 |
+
# with c2:
|
135 |
+
# st.write('**GHG Related Paragraphs**: `{}`'.format(count_ghg))
|
136 |
+
# st.write('**Economy-wide Related Paragraphs**: `{}`'.format(count_economy))
|
137 |
+
# st.write('-------------------')
|
138 |
+
# hits = hits.sort_values(by=['Relevancy'], ascending=False)
|
139 |
+
# netzerohit = hits[hits['Netzero Label'] == 'NETZERO']
|
140 |
+
# if not netzerohit.empty:
|
141 |
+
# netzerohit = netzerohit.sort_values(by = ['Netzero Score'], ascending = False)
|
142 |
+
# # st.write('-------------------')
|
143 |
+
# # st.markdown("###### Netzero paragraph ######")
|
144 |
+
# st.write('**Netzero paragraph** `page {}`: {}'.format(netzerohit.iloc[0]['page'],
|
145 |
+
# netzerohit.iloc[0]['text'].replace("\n", " ")))
|
146 |
+
# st.write("")
|
147 |
+
# else:
|
148 |
+
# st.info("π€ No Netzero paragraph found")
|
149 |
|
150 |
+
# # st.write("**Result {}** `page {}` (Relevancy Score: {:.2f})'".format(i+1,hits.iloc[i]['page'],hits.iloc[i]['Relevancy'])")
|
151 |
+
# st.write('-------------------')
|
152 |
+
# st.markdown("###### Top few Target Classified paragraph/text results ######")
|
153 |
+
# range_val = min(5,len(hits))
|
154 |
+
# for i in range(range_val):
|
155 |
+
# # the page number reflects the page that contains the main paragraph
|
156 |
+
# # according to split limit, the overlapping part can be on a separate page
|
157 |
+
# st.write('**Result {}** (Relevancy Score: {:.2f}): `page {}`, `Sector: {}`,\
|
158 |
+
# `GHG: {}`, `Adapt-Mitig :{}`'\
|
159 |
+
# .format(i+1,hits.iloc[i]['Relevancy'],
|
160 |
+
# hits.iloc[i]['page'], hits.iloc[i]['Sector Label'],
|
161 |
+
# hits.iloc[i]['GHG Label'],hits.iloc[i]['Adapt-Mitig Label']))
|
162 |
+
# st.write("\t Text: \t{}".format(hits.iloc[i]['text'].replace("\n", " ")))
|
163 |
+
# hits = hits.reset_index(drop =True)
|
164 |
+
# st.write('----------------')
|
165 |
+
# st.write('Explore the data')
|
166 |
+
# st.write(hits)
|
167 |
+
# df_xlsx = to_excel(df)
|
168 |
|
169 |
+
# with st.sidebar:
|
170 |
+
# st.write('-------------')
|
171 |
+
# st.download_button(label='π₯ Download Result',
|
172 |
+
# data=df_xlsx ,
|
173 |
+
# file_name= os.path.splitext(st.session_state['filename'])[0]+'.xlsx')
|
174 |
|
175 |
+
# else:
|
176 |
+
# st.info("π€ No Targets found")
|