启用ocr中的cls功能
This commit is contained in:
@@ -10,7 +10,7 @@ import cv2
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from photo_review.photo_review import split_image
|
||||
from photo_review.photo_review import split_image, get_ocr_layout
|
||||
from paddlenlp import Taskflow
|
||||
from paddlenlp.utils.doc_parser import DocParser
|
||||
from ucloud import ucloud
|
||||
@@ -70,7 +70,7 @@ def visual_model_test(model_type, test_img, task_path, schema):
|
||||
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_file:
|
||||
cv2.imwrite(temp_file.name, img["img"])
|
||||
temp_files_paths.append(temp_file.name)
|
||||
docs.append({"doc": temp_file.name})
|
||||
docs.append({"doc": temp_file.name, "layout": get_ocr_layout(temp_file.name)})
|
||||
|
||||
my_ie = Taskflow("information_extraction", schema=schema, model="uie-x-base", task_path=task_path,
|
||||
layout_analysis=False)
|
||||
@@ -133,7 +133,7 @@ def main(model_type, pic_name=None):
|
||||
|
||||
if __name__ == '__main__':
|
||||
# main("ocr")
|
||||
main("settlement", "PH20240529000194_1_075936_1.PNG")
|
||||
main("settlement")
|
||||
# main("discharge")
|
||||
# main("cost")
|
||||
# main("cost_detail")
|
||||
|
||||
Reference in New Issue
Block a user