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 |
-
|
| 69 |
-
|
| 70 |
-
label =
|
| 71 |
-
score =
|
| 72 |
|
| 73 |
if label == '0' and score >= 0.75:
|
| 74 |
-
|
| 75 |
prediction_res = [{"label":"Neutral"}]
|
| 76 |
else:
|
| 77 |
-
|
| 78 |
-
logger.info("Prediction %s",
|
| 79 |
-
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}]
|