update GHG
Browse files- appStore/ghg.py +0 -7
- utils/ghg_classifier.py +4 -5
appStore/ghg.py
CHANGED
@@ -21,13 +21,6 @@ import plotly.express as px
|
|
21 |
classifier_identifier = 'ghg'
|
22 |
params = get_classifier_params(classifier_identifier)
|
23 |
|
24 |
-
# Labels dictionary ###
|
25 |
-
_lab_dict = {
|
26 |
-
'NEGATIVE':'NO GHG TARGET',
|
27 |
-
'NA':'NOT APPLICABLE',
|
28 |
-
'TARGET':'GHG TARGET',
|
29 |
-
}
|
30 |
-
|
31 |
|
32 |
def app():
|
33 |
### Main app code ###
|
|
|
21 |
classifier_identifier = 'ghg'
|
22 |
params = get_classifier_params(classifier_identifier)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def app():
|
26 |
### Main app code ###
|
utils/ghg_classifier.py
CHANGED
@@ -10,10 +10,9 @@ from transformers import pipeline
|
|
10 |
|
11 |
# Labels dictionary ###
|
12 |
_lab_dict = {
|
13 |
-
'
|
14 |
-
'
|
15 |
-
'
|
16 |
-
'NA':'NA',
|
17 |
}
|
18 |
|
19 |
|
@@ -85,7 +84,7 @@ def ghg_classification(haystack_doc:pd.DataFrame,
|
|
85 |
results = classifier_model(list(temp.text))
|
86 |
labels_= [(l[0]['label'],l[0]['score']) for l in results]
|
87 |
temp['GHG Label'],temp['GHG Score'] = zip(*labels_)
|
88 |
-
|
89 |
# merge back Target and non-Target dataframe
|
90 |
df = pd.concat([df,temp])
|
91 |
df['GHG Label'] = df['GHG Label'].apply(lambda i: _lab_dict[i])
|
|
|
10 |
|
11 |
# Labels dictionary ###
|
12 |
_lab_dict = {
|
13 |
+
'GHG':'GHG',
|
14 |
+
'NOT_GHG':'NON GHG TRANSPORT TARGET',
|
15 |
+
'NEGATIVE':'OTHERS',
|
|
|
16 |
}
|
17 |
|
18 |
|
|
|
84 |
results = classifier_model(list(temp.text))
|
85 |
labels_= [(l[0]['label'],l[0]['score']) for l in results]
|
86 |
temp['GHG Label'],temp['GHG Score'] = zip(*labels_)
|
87 |
+
temp['GHG Label'] = temp['GHG Label'].apply(lambda x: _lab_dict[x])
|
88 |
# merge back Target and non-Target dataframe
|
89 |
df = pd.concat([df,temp])
|
90 |
df['GHG Label'] = df['GHG Label'].apply(lambda i: _lab_dict[i])
|