code: def draw_structure_result(image, result, font_path):
      if isinstance(image, np.ndarray):
          image = Image.fromarray(image)
      boxes, txts, scores = [], [], []
  
      img_layout = image.copy()
      draw_layout = ImageDraw.Draw(img_layout)
      text_color = (255, 255, 255)
      text_background_color = (80, 127, 255)
      catid2color = {}
      font_size = 15
      font = ImageFont.truetype(font_path, font_size, encoding="utf-8")
  
      for region in result:
          if region["type"] not in catid2color:
              box_color = (
                  random.randint(0, 255),
                  random.randint(0, 255),
                  random.randint(0, 255),
              )
              catid2color[region["type"]] = box_color
          else:
              box_color = catid2color[region["type"]]
          box_layout = region["bbox"]
          draw_layout.rectangle(
              [
                  (box_layout[0], box_layout[1]),
                  (box_layout[2], box_layout[3]),
              ],
              outline=box_color,
              width=3,
          )
          left, top, right, bottom = font.getbbox(region["type"])
          text_w, text_h = right - left, bottom - top
          draw_layout.rectangle(
              [
                  (box_layout[0], box_layout[1]),
                  (box_layout[0] + text_w, box_layout[1] + text_h),
              ],
              fill=text_background_color,
          )
          draw_layout.text(
              (box_layout[0], box_layout[1]),
              region["type"],
              fill=text_color,
              font=font,
          )
  
          if region["type"] == "table":
              pass
          else:
              for text_result in region["res"]:
                  boxes.append(np.array(text_result["text_region"]))
                  txts.append(text_result["text"])
                  scores.append(text_result["confidence"])
  
      im_show = draw_ocr_box_txt(
          img_layout,
          boxes,
          txts,
          scores,
          font_path=font_path,
          drop_score=0,
      )
      return im_show
  
file_path: PaddleOCR/ppstructure/utility.py
imports: import random
  import ast
  from PIL import Image, ImageDraw, ImageFont
  import numpy
  from tools.infer.utility import draw_ocr_box_txt, str2bool, str2int_tuple, init_args
label_desc: Use image node_id 3 for calling a global function with example usage: draw_structure_result(image, result, font_path) and returns: im_show