ghg check
Browse files- appStore/ghg.py +25 -25
- appStore/netzero.py +25 -25
- utils/ghg_classifier.py +2 -0
appStore/ghg.py
CHANGED
@@ -64,32 +64,32 @@ def app():
|
|
64 |
st.session_state.key1 = df
|
65 |
|
66 |
|
67 |
-
def netzero_display():
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
|
|
|
64 |
st.session_state.key1 = df
|
65 |
|
66 |
|
67 |
+
# def netzero_display():
|
68 |
+
# if 'key1' in st.session_state:
|
69 |
+
# df = st.session_state.key2
|
70 |
+
# hits = df[df['GHG Label'] == 'TARGET']
|
71 |
+
# range_val = min(5,len(hits))
|
72 |
+
# if range_val !=0:
|
73 |
+
# count_df = df['GHG Label'].value_counts()
|
74 |
+
# count_df = count_df.rename('count')
|
75 |
+
# count_df = count_df.rename_axis('GHG Label').reset_index()
|
76 |
+
# count_df['Label_def'] = count_df['GHG Label'].apply(lambda x: _lab_dict[x])
|
77 |
|
78 |
+
# fig = px.bar(count_df, y="Label_def", x="count", orientation='h', height =200)
|
79 |
+
# c1, c2 = st.columns([1,1])
|
80 |
+
# with c1:
|
81 |
+
# st.plotly_chart(fig,use_container_width= True)
|
82 |
|
83 |
+
# hits = hits.sort_values(by=['GHG Score'], ascending=False)
|
84 |
+
# st.write("")
|
85 |
+
# st.markdown("###### Top few GHG Target Classified paragraph/text results ######")
|
86 |
+
# range_val = min(5,len(hits))
|
87 |
+
# for i in range(range_val):
|
88 |
+
# # the page number reflects the page that contains the main paragraph
|
89 |
+
# # according to split limit, the overlapping part can be on a separate page
|
90 |
+
# st.write('**Result {}** `page {}` (Relevancy Score: {:.2f})'.format(i+1,hits.iloc[i]['page'],hits.iloc[i]['GHG Score']))
|
91 |
+
# st.write("\t Text: \t{}".format(hits.iloc[i]['text']))
|
92 |
+
# else:
|
93 |
+
# st.info("🤔 No GHG target found")
|
94 |
|
95 |
|
appStore/netzero.py
CHANGED
@@ -64,32 +64,32 @@ def app():
|
|
64 |
st.session_state.key1 = df
|
65 |
|
66 |
|
67 |
-
def netzero_display():
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
|
|
|
64 |
st.session_state.key1 = df
|
65 |
|
66 |
|
67 |
+
# def netzero_display():
|
68 |
+
# if 'key1' in st.session_state:
|
69 |
+
# df = st.session_state.key2
|
70 |
+
# hits = df[df['Netzero Label'] == 'NETZERO']
|
71 |
+
# range_val = min(5,len(hits))
|
72 |
+
# if range_val !=0:
|
73 |
+
# count_df = df['Netzero Label'].value_counts()
|
74 |
+
# count_df = count_df.rename('count')
|
75 |
+
# count_df = count_df.rename_axis('Netzero Label').reset_index()
|
76 |
+
# count_df['Label_def'] = count_df['Netzero Label'].apply(lambda x: _lab_dict[x])
|
77 |
|
78 |
+
# fig = px.bar(count_df, y="Label_def", x="count", orientation='h', height =200)
|
79 |
+
# c1, c2 = st.columns([1,1])
|
80 |
+
# with c1:
|
81 |
+
# st.plotly_chart(fig,use_container_width= True)
|
82 |
|
83 |
+
# hits = hits.sort_values(by=['Netzero Score'], ascending=False)
|
84 |
+
# st.write("")
|
85 |
+
# st.markdown("###### Top few NetZero Target Classified paragraph/text results ######")
|
86 |
+
# range_val = min(5,len(hits))
|
87 |
+
# for i in range(range_val):
|
88 |
+
# # the page number reflects the page that contains the main paragraph
|
89 |
+
# # according to split limit, the overlapping part can be on a separate page
|
90 |
+
# st.write('**Result {}** `page {}` (Relevancy Score: {:.2f})'.format(i+1,hits.iloc[i]['page'],hits.iloc[i]['Netzero Score']))
|
91 |
+
# st.write("\t Text: \t{}".format(hits.iloc[i]['text']))
|
92 |
+
# else:
|
93 |
+
# st.info("🤔 No Netzero target found")
|
94 |
|
95 |
|
utils/ghg_classifier.py
CHANGED
@@ -76,7 +76,9 @@ def ghg_classification(haystack_doc:pd.DataFrame,
|
|
76 |
haystack_doc['GHG Label'] = 'NA'
|
77 |
haystack_doc['GHG Score'] = 'NA'
|
78 |
temp = haystack_doc[haystack_doc['Target Label'] == 'TARGET']
|
|
|
79 |
df = haystack_doc[haystack_doc['Target Label'] == 'NEGATIVE']
|
|
|
80 |
|
81 |
if not classifier_model:
|
82 |
classifier_model = st.session_state['ghg_classifier']
|
|
|
76 |
haystack_doc['GHG Label'] = 'NA'
|
77 |
haystack_doc['GHG Score'] = 'NA'
|
78 |
temp = haystack_doc[haystack_doc['Target Label'] == 'TARGET']
|
79 |
+
temp = temp.reset_index(drop=True)
|
80 |
df = haystack_doc[haystack_doc['Target Label'] == 'NEGATIVE']
|
81 |
+
df = df.reset_index(drop=True)
|
82 |
|
83 |
if not classifier_model:
|
84 |
classifier_model = st.session_state['ghg_classifier']
|