remove unnessary img save
This commit is contained in:
@@ -40,10 +40,7 @@ def process(
|
||||
imgsz
|
||||
) -> Optional[Image.Image]:
|
||||
|
||||
image_save_path = 'imgs/saved_image_demo.png'
|
||||
image_input.save(image_save_path)
|
||||
image = Image.open(image_save_path)
|
||||
box_overlay_ratio = image.size[0] / 3200
|
||||
box_overlay_ratio = image_input.size[0] / 3200
|
||||
draw_bbox_config = {
|
||||
'text_scale': 0.8 * box_overlay_ratio,
|
||||
'text_thickness': max(int(2 * box_overlay_ratio), 1),
|
||||
@@ -52,10 +49,9 @@ def process(
|
||||
}
|
||||
# import pdb; pdb.set_trace()
|
||||
|
||||
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)
|
||||
ocr_bbox_rslt, is_goal_filtered = check_ocr_box(image_input, display_img = False, output_bb_format='xyxy', goal_filtering=None, easyocr_args={'paragraph': False, 'text_threshold':0.9}, use_paddleocr=use_paddleocr)
|
||||
text, ocr_bbox = ocr_bbox_rslt
|
||||
# print('prompt:', prompt)
|
||||
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, imgsz=imgsz,)
|
||||
dino_labled_img, label_coordinates, parsed_content_list = get_som_labeled_img(image_input, 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, imgsz=imgsz,)
|
||||
image = Image.open(io.BytesIO(base64.b64decode(dino_labled_img)))
|
||||
print('finish processing')
|
||||
parsed_content_list = '\n'.join([f'icon {i}: ' + str(v) for i,v in enumerate(parsed_content_list)])
|
||||
|
||||
Reference in New Issue
Block a user