87525e99 by 周伟奇

fix afc e-contract

1 parent 9bab1769
......@@ -9,8 +9,23 @@ from .get_char import Finder
def predict(pdf_info):
ocr_results = {}
for pno in pdf_info:
ocr_results[pno] = {}
for key, block in enumerate(pdf_info[pno]['blocks']):
if block['type'] != 0:
continue
for line in block['lines']:
for span in line['spans']:
bbox, text = span['bbox'], span['text']
# print(text)
xmin, ymin, xmax, ymax = bbox
polygon = [xmin, ymin, xmax, ymin, xmax, ymax, xmin, ymax]
text = text.replace(":", ":").replace(" ", "")
ocr_results[pno][key] = [polygon, text]
# 输入是整个 PDF 中的信息
f = Finder(pdf_info)
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!