Kalaoke commited on
Commit
1c87edc
·
1 Parent(s): 794d04c

add custom handler and modify log info

Browse files
__pycache__/bert_for_sequence_classification.cpython-37.pyc CHANGED
Binary files a/__pycache__/bert_for_sequence_classification.cpython-37.pyc and b/__pycache__/bert_for_sequence_classification.cpython-37.pyc differ
 
__pycache__/bibert_multitask_classification.cpython-37.pyc CHANGED
Binary files a/__pycache__/bibert_multitask_classification.cpython-37.pyc and b/__pycache__/bibert_multitask_classification.cpython-37.pyc differ
 
__pycache__/handler.cpython-37.pyc CHANGED
Binary files a/__pycache__/handler.cpython-37.pyc and b/__pycache__/handler.cpython-37.pyc differ
 
handler.py CHANGED
@@ -65,18 +65,18 @@ class EndpointHandler():
65
 
66
  t0 = perf_counter()
67
  prediction_res = []
68
- prediction_p = self.classifier_p(inputs)
69
- logger.info(prediction_p)
70
- label = prediction_p[0]['label']
71
- score = prediction_p[0]['score']
72
 
73
  if label == '0' and score >= 0.75:
74
-
75
  prediction_res = [{"label":"Neutral"}]
76
  else:
77
- classifier_res = self.classifier_s(inputs)
78
- logger.info("Prediction %s", classifier_res)
79
- label = classifier_res[0]['label']
80
  for key in idtolabel.keys():
81
  label = label.replace(key, idtolabel[key])
82
  prediction_res = [{"label":label}]
 
65
 
66
  t0 = perf_counter()
67
  prediction_res = []
68
+ classifier_pol = self.classifier_p(inputs)
69
+
70
+ label = classifier_pol[0]['label']
71
+ score = classifier_pol[0]['score']
72
 
73
  if label == '0' and score >= 0.75:
74
+ logger.info("Prediction polarity %s", classifier_pol)
75
  prediction_res = [{"label":"Neutral"}]
76
  else:
77
+ classifier_subj = self.classifier_s(inputs)
78
+ logger.info("Prediction subjective %s", classifier_subj)
79
+ label = classifier_subj[0]['label']
80
  for key in idtolabel.keys():
81
  label = label.replace(key, idtolabel[key])
82
  prediction_res = [{"label":label}]