调整taskflow的生成位置
This commit is contained in:
@@ -20,14 +20,14 @@ LAYOUT_ANALYSIS = False
|
||||
# 可使用的GPU
|
||||
CUDA_VISIBLE_DEVICES = "1"
|
||||
|
||||
# 基本医保结算单
|
||||
SETTLEMENT_IE = Taskflow("information_extraction", schema=SETTLEMENT_LIST_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/settlement_list_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
|
||||
# 出院记录
|
||||
DISCHARGE_IE = Taskflow("information_extraction", schema=DISCHARGE_RECORD_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/discharge_record_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
|
||||
# 费用清单
|
||||
COST_IE = Taskflow("information_extraction", schema=COST_LIST_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/cost_list_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
# # 基本医保结算单
|
||||
# SETTLEMENT_IE = Taskflow("information_extraction", schema=SETTLEMENT_LIST_SCHEMA, model="uie-x-base",
|
||||
# task_path="config/model/settlement_list_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
#
|
||||
# # 出院记录
|
||||
# DISCHARGE_IE = Taskflow("information_extraction", schema=DISCHARGE_RECORD_SCHEMA, model="uie-x-base",
|
||||
# task_path="config/model/discharge_record_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
#
|
||||
# # 费用清单
|
||||
# COST_IE = Taskflow("information_extraction", schema=COST_LIST_SCHEMA, model="uie-x-base",
|
||||
# task_path="config/model/cost_list_model", layout_analysis=LAYOUT_ANALYSIS)
|
||||
|
||||
@@ -11,15 +11,16 @@ import cv2
|
||||
import numpy as np
|
||||
import paddle
|
||||
import paddleclas
|
||||
from paddlenlp import Taskflow
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from time import sleep
|
||||
from sqlalchemy import update
|
||||
from config.keys import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_EXPENSES, PERSONAL_CASH_PAYMENT, \
|
||||
PERSONAL_ACCOUNT_PAYMENT, PERSONAL_FUNDED_AMOUNT, MEDICAL_INSURANCE_TYPE, HOSPITAL, DEPARTMENT, DOCTOR
|
||||
PERSONAL_ACCOUNT_PAYMENT, PERSONAL_FUNDED_AMOUNT, MEDICAL_INSURANCE_TYPE, HOSPITAL, DEPARTMENT, DOCTOR, SETTLEMENT_LIST_SCHEMA, DISCHARGE_RECORD_SCHEMA, COST_LIST_SCHEMA
|
||||
from config.mysql import MysqlSession
|
||||
from config.photo_review import PHHD_BATCH_SIZE, SLEEP_MINUTES, SETTLEMENT_IE, DISCHARGE_IE, COST_IE
|
||||
from config.photo_review import PHHD_BATCH_SIZE, SLEEP_MINUTES, LAYOUT_ANALYSIS
|
||||
from photo_review.entity.bd_yljg import BdYljg
|
||||
from photo_review.entity.bd_ylks import BdYlks
|
||||
from photo_review.entity.zx_ie_cost import ZxIeCost
|
||||
@@ -174,7 +175,7 @@ def information_extraction(ie, phrecs):
|
||||
|
||||
# 完成一次任务释放显存
|
||||
paddle.device.cuda.empty_cache()
|
||||
logging.info("释放显存完成")
|
||||
logging.info("显存释放完成")
|
||||
return result
|
||||
|
||||
|
||||
@@ -248,7 +249,8 @@ def photo_review(pk_phhd):
|
||||
elif phrec.cRectype == "4":
|
||||
cost_list.append(phrec)
|
||||
|
||||
settlement_list_ie_result = information_extraction(SETTLEMENT_IE, settlement_list)
|
||||
settlement_list_ie_result = information_extraction(Taskflow("information_extraction", schema=SETTLEMENT_LIST_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/settlement_list_model", layout_analysis=LAYOUT_ANALYSIS), settlement_list)
|
||||
settlement_data = {
|
||||
"pk_phhd": pk_phhd,
|
||||
"name": handle_name(get_best_value_in_keys(settlement_list_ie_result, PATIENT_NAME)),
|
||||
@@ -274,7 +276,8 @@ def photo_review(pk_phhd):
|
||||
settlement_data["personal_funded_amount"] = handle_decimal(settlement_data["personal_funded_amount_str"])
|
||||
save_or_update_ie(ZxIeSettlement, pk_phhd, settlement_data)
|
||||
|
||||
discharge_record_ie_result = information_extraction(DISCHARGE_IE, discharge_record)
|
||||
discharge_record_ie_result = information_extraction(Taskflow("information_extraction", schema=DISCHARGE_RECORD_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/discharge_record_model", layout_analysis=LAYOUT_ANALYSIS), discharge_record)
|
||||
discharge_data = {
|
||||
"pk_phhd": pk_phhd,
|
||||
"hospital": handle_hospital(get_best_value_in_keys(discharge_record_ie_result, HOSPITAL)),
|
||||
@@ -311,7 +314,8 @@ def photo_review(pk_phhd):
|
||||
discharge_data["department"] = ylks.name
|
||||
save_or_update_ie(ZxIeDischarge, pk_phhd, discharge_data)
|
||||
|
||||
cost_list_ie_result = information_extraction(COST_IE, cost_list)
|
||||
cost_list_ie_result = information_extraction(Taskflow("information_extraction", schema=COST_LIST_SCHEMA, model="uie-x-base",
|
||||
task_path="config/model/cost_list_model", layout_analysis=LAYOUT_ANALYSIS), cost_list)
|
||||
cost_data = {
|
||||
"pk_phhd": pk_phhd,
|
||||
"name": handle_name(get_best_value_in_keys(cost_list_ie_result, PATIENT_NAME)),
|
||||
|
||||
Reference in New Issue
Block a user