modify how to get label
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
|
@@ -75,10 +75,8 @@ class EndpointHandler():
|
|
| 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}]
|
| 83 |
elapsed = 1000 * (perf_counter() - t0)
|
| 84 |
logger.info("Model prediction time: %d ms.", elapsed)
|
|
|
|
| 75 |
prediction_res = [{"label":"Neutral"}]
|
| 76 |
else:
|
| 77 |
classifier_subj = self.classifier_s(inputs)
|
| 78 |
+
logger.info("Prediction subjective %s", classifier_subj)
|
| 79 |
+
label = idtolabel.get(classifier_subj[0]['label'])
|
|
|
|
|
|
|
| 80 |
prediction_res = [{"label":label}]
|
| 81 |
elapsed = 1000 * (perf_counter() - t0)
|
| 82 |
logger.info("Model prediction time: %d ms.", elapsed)
|