5eb7c67e by 冯轩

ADD:log

1 parent 35069885
......@@ -1494,7 +1494,7 @@ class Command(BaseCommand, LoggerMixin):
# AFC合同
if classify_1_str == str(consts.CONTRACT_CLASSIFY):
is_fsm = doc.is_ovp_fsm == 1
ocr_result = afc_predict(pdf_handler.pdf_info, is_fsm=is_fsm)
ocr_result = afc_predict(self,pdf_handler.pdf_info, is_fsm=is_fsm)
page_res = {}
for page_num, page_info in ocr_result.get('page_info', {}).items():
if isinstance(page_num, str) and page_num.startswith('page_'):
......
......@@ -1117,7 +1117,7 @@ class DocView(DocGenericView, DocHandler):
data_source = request.POST.get('data_source', '')
document_name = request.POST.get('document_name', '')
fsm = request.POST.get('is_fsm', 'N')
args = {'business_type':business_type,'document_scheme':document_scheme,'data_source':data_source,'document_name':document_name,'pdf_file':pdf_file}
args = {'business_type':business_type,'document_scheme':document_scheme,'data_source':data_source,'document_name':document_name,'pdf_file':pdf_file,'fsm':fsm}
# business_type = random.choice(consts.BUSINESS_TYPE_LIST)
# business_type = consts.BUSINESS_TYPE_LIST[0]
tmp_save_path = os.path.join(conf.DATA_DIR, business_type, '{0}.pdf'.format(metadata_version_id))
......
......@@ -24,7 +24,7 @@ def extract_info(ocr_results):
return {'page_1': {'合同编号': contract_no}}
def predict(pdf_info, is_qrs=False, is_fsm=False):
def predict(self, pdf_info, is_qrs=False, is_fsm=False):
pop_seceond_page_info = {}
if not is_fsm and not is_qrs and len(pdf_info) == 9:
pop_seceond_page_info = pdf_info.pop('1', {})
......@@ -61,8 +61,10 @@ def predict(pdf_info, is_qrs=False, is_fsm=False):
else:
# 输入是整个 PDF 中的信息
if is_fsm:
self.online_log.info('afc_contract_is_fsm')
f = FSMFinder(pdf_info, ocr_results=ocr_results)
else:
self.online_log.info('afc_contract_is_non_fsm')
f = Finder(pdf_info, ocr_results=ocr_results)
results = f.get_info()
return results
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!