diff --git a/photo_review/photo_review.py b/photo_review/photo_review.py index 71f02be..2d23df9 100644 --- a/photo_review/photo_review.py +++ b/photo_review/photo_review.py @@ -27,10 +27,13 @@ def information_extraction(schema, phrecs, task_path): ie = Taskflow("information_extraction", schema=schema, model="uie-x-base", task_path=task_path) result = ie({"doc": pic_path}) + result_json = json.dumps(result, ensure_ascii=False) + if len(result_json) > 5000: + result_json = result_json[:5000] # 提取完保存每张图片的结果 session = MysqlSession() zx_ocr = ZxOcr(pk_phhd=phrec.pk_phhd, pk_phrec=phrec.pk_phrec, cfjaddress=phrec.cfjaddress, - content=json.dumps(result, ensure_ascii=False)) + content=result_json) session.add(zx_ocr) session.commit() session.close()