调整文本分类的判空
This commit is contained in:
@@ -17,9 +17,9 @@ CLAS = Taskflow('zero_shot_text_classification', model='utc-xbase', schema=schem
|
||||
def main():
|
||||
text = request.form.get('text')
|
||||
cls_result = CLAS(text)
|
||||
if not cls_result:
|
||||
return None
|
||||
cls_result = cls_result[0].get('predictions')[0]
|
||||
cls_result = cls_result[0].get('predictions')
|
||||
if cls_result:
|
||||
cls_result = cls_result[0]
|
||||
if cls_result['score'] < 0.8:
|
||||
logging.info(f"识别结果置信度{cls_result['score']}过低!text: {text}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user