ppsingh commited on
Commit
9b41a4d
1 Parent(s): 98be5b8

update GHG

Browse files
Files changed (2) hide show
  1. appStore/ghg.py +0 -7
  2. 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
- 'LABEL_0':'NEGATIVE',
14
- 'LABEL_1':'NOT GHG',
15
- 'LABEL_2':'GHG',
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])