From 371045022126ab1d60ea587f69be89b1aae5e52f Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Fri, 18 Oct 2024 09:42:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=88=86=E7=B1=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/paddle_services/clas_text.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/paddle_services/clas_text.py b/services/paddle_services/clas_text.py index 3f4f809..67fd5a4 100644 --- a/services/paddle_services/clas_text.py +++ b/services/paddle_services/clas_text.py @@ -9,7 +9,7 @@ from utils import process_request app = Flask(__name__) schema = ['基本医保结算单', '出院记录', '费用清单'] CLAS = Taskflow('zero_shot_text_classification', model='utc-xbase', schema=schema, - task_path='model/text_classification', precision='fp32') + task_path='model/text_classification', precision='fp16') @app.route('/', methods=['POST']) @@ -17,6 +17,8 @@ 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] if cls_result['score'] < 0.8: logging.info(f"识别结果置信度{cls_result['score']}过低!text: {text}")