1eb06fcb by 冯轩

Merge branch 'feature/CHINARPA-4495'

2 parents 15f1cc16 5eb7c67e
...@@ -1494,7 +1494,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1494,7 +1494,7 @@ class Command(BaseCommand, LoggerMixin):
1494 # AFC合同 1494 # AFC合同
1495 if classify_1_str == str(consts.CONTRACT_CLASSIFY): 1495 if classify_1_str == str(consts.CONTRACT_CLASSIFY):
1496 is_fsm = doc.is_ovp_fsm == 1 1496 is_fsm = doc.is_ovp_fsm == 1
1497 ocr_result = afc_predict(pdf_handler.pdf_info, is_fsm=is_fsm) 1497 ocr_result = afc_predict(self,pdf_handler.pdf_info, is_fsm=is_fsm)
1498 page_res = {} 1498 page_res = {}
1499 for page_num, page_info in ocr_result.get('page_info', {}).items(): 1499 for page_num, page_info in ocr_result.get('page_info', {}).items():
1500 if isinstance(page_num, str) and page_num.startswith('page_'): 1500 if isinstance(page_num, str) and page_num.startswith('page_'):
......
...@@ -1116,7 +1116,8 @@ class DocView(DocGenericView, DocHandler): ...@@ -1116,7 +1116,8 @@ class DocView(DocGenericView, DocHandler):
1116 document_scheme = request.POST.get('document_scheme', '') 1116 document_scheme = request.POST.get('document_scheme', '')
1117 data_source = request.POST.get('data_source', '') 1117 data_source = request.POST.get('data_source', '')
1118 document_name = request.POST.get('document_name', '') 1118 document_name = request.POST.get('document_name', '')
1119 args = {'business_type':business_type,'document_scheme':document_scheme,'data_source':data_source,'document_name':document_name,'pdf_file':pdf_file} 1119 fsm = request.POST.get('is_fsm', 'N')
1120 args = {'business_type':business_type,'document_scheme':document_scheme,'data_source':data_source,'document_name':document_name,'pdf_file':pdf_file,'fsm':fsm}
1120 # business_type = random.choice(consts.BUSINESS_TYPE_LIST) 1121 # business_type = random.choice(consts.BUSINESS_TYPE_LIST)
1121 # business_type = consts.BUSINESS_TYPE_LIST[0] 1122 # business_type = consts.BUSINESS_TYPE_LIST[0]
1122 tmp_save_path = os.path.join(conf.DATA_DIR, business_type, '{0}.pdf'.format(metadata_version_id)) 1123 tmp_save_path = os.path.join(conf.DATA_DIR, business_type, '{0}.pdf'.format(metadata_version_id))
...@@ -1166,6 +1167,7 @@ class DocView(DocGenericView, DocHandler): ...@@ -1166,6 +1167,7 @@ class DocView(DocGenericView, DocHandler):
1166 # co_applicant='', 1167 # co_applicant='',
1167 # guarantor_1='', 1168 # guarantor_1='',
1168 # guarantor_2='', 1169 # guarantor_2='',
1170 is_ovp_fsm=1 if fsm == 'Y' else 0,
1169 document_name=application_id, 1171 document_name=application_id,
1170 document_scheme=document_scheme, 1172 document_scheme=document_scheme,
1171 data_source=data_source, 1173 data_source=data_source,
......
...@@ -24,7 +24,7 @@ def extract_info(ocr_results): ...@@ -24,7 +24,7 @@ def extract_info(ocr_results):
24 return {'page_1': {'合同编号': contract_no}} 24 return {'page_1': {'合同编号': contract_no}}
25 25
26 26
27 def predict(pdf_info, is_qrs=False, is_fsm=False): 27 def predict(self, pdf_info, is_qrs=False, is_fsm=False):
28 pop_seceond_page_info = {} 28 pop_seceond_page_info = {}
29 if not is_fsm and not is_qrs and len(pdf_info) == 9: 29 if not is_fsm and not is_qrs and len(pdf_info) == 9:
30 pop_seceond_page_info = pdf_info.pop('1', {}) 30 pop_seceond_page_info = pdf_info.pop('1', {})
...@@ -61,8 +61,10 @@ def predict(pdf_info, is_qrs=False, is_fsm=False): ...@@ -61,8 +61,10 @@ def predict(pdf_info, is_qrs=False, is_fsm=False):
61 else: 61 else:
62 # 输入是整个 PDF 中的信息 62 # 输入是整个 PDF 中的信息
63 if is_fsm: 63 if is_fsm:
64 self.online_log.info('afc_contract_is_fsm')
64 f = FSMFinder(pdf_info, ocr_results=ocr_results) 65 f = FSMFinder(pdf_info, ocr_results=ocr_results)
65 else: 66 else:
67 self.online_log.info('afc_contract_is_non_fsm')
66 f = Finder(pdf_info, ocr_results=ocr_results) 68 f = Finder(pdf_info, ocr_results=ocr_results)
67 results = f.get_info() 69 results = f.get_info()
68 return results 70 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!