5858def process (
5959 image_input ,
6060 box_threshold ,
61- iou_threshold
61+ iou_threshold ,
62+ use_paddleocr
6263) -> Optional [Image .Image ]:
6364
6465 image_save_path = 'imgs/saved_image_demo.png'
6566 image_input .save (image_save_path )
6667 # import pdb; pdb.set_trace()
6768
68- ocr_bbox_rslt , is_goal_filtered = check_ocr_box (image_save_path , display_img = False , output_bb_format = 'xyxy' , goal_filtering = None , easyocr_args = {'paragraph' : False , 'text_threshold' :0.9 })
69+ ocr_bbox_rslt , is_goal_filtered = check_ocr_box (image_save_path , display_img = False , output_bb_format = 'xyxy' , goal_filtering = None , easyocr_args = {'paragraph' : False , 'text_threshold' :0.9 }, use_paddleocr = use_paddleocr )
6970 text , ocr_bbox = ocr_bbox_rslt
7071 # print('prompt:', prompt)
7172 dino_labled_img , label_coordinates , parsed_content_list = get_som_labeled_img (image_save_path , yolo_model , BOX_TRESHOLD = box_threshold , output_coord_in_ratio = True , ocr_bbox = ocr_bbox ,draw_bbox_config = draw_bbox_config , caption_model_processor = caption_model_processor , ocr_text = text ,iou_threshold = iou_threshold )
@@ -88,6 +89,8 @@ def process(
8889 # set the threshold for removing the bounding boxes with large overlap, default is 0.1
8990 iou_threshold_component = gr .Slider (
9091 label = 'IOU Threshold' , minimum = 0.01 , maximum = 1.0 , step = 0.01 , value = 0.1 )
92+ use_paddleocr_component = gr .Checkbox (
93+ label = 'Use PaddleOCR' , default = True )
9194 submit_button_component = gr .Button (
9295 value = 'Submit' , variant = 'primary' )
9396 with gr .Column ():
@@ -99,7 +102,8 @@ def process(
99102 inputs = [
100103 image_input_component ,
101104 box_threshold_component ,
102- iou_threshold_component
105+ iou_threshold_component ,
106+ use_paddleocr_component
103107 ],
104108 outputs = [image_output_component , text_output_component ]
105109 )
0 commit comments