code: def text_visual(
      texts,
      scores,
      img_h=400,
      img_w=600,
      threshold=0.0,
      font_path="./doc/simfang.ttf",
  ):
      """
      create new blank img and draw txt on it
      args:
          texts(list): the text will be draw
          scores(list|None): corresponding score of each txt
          img_h(int): the height of blank img
          img_w(int): the width of blank img
          font_path: the path of font which is used to draw text
      return(array):
      """
      if scores is not None:
          assert len(texts) == len(
              scores
          ), "The number of txts and corresponding scores must match"
  
      def create_blank_img():
          blank_img = np.ones(shape=[img_h, img_w], dtype=np.int8) * 255
          blank_img[:, img_w - 1 :] = 0
          blank_img = Image.fromarray(blank_img).convert("RGB")
          draw_txt = ImageDraw.Draw(blank_img)
          return blank_img, draw_txt
  
      blank_img, draw_txt = create_blank_img()
  
      font_size = 20
      txt_color = (0, 0, 0)
      font = ImageFont.truetype(font_path, font_size, encoding="utf-8")
  
      gap = font_size + 5
      txt_img_list = []
      count, index = 1, 0
      for idx, txt in enumerate(texts):
          index += 1
          if scores[idx] < threshold or math.isnan(scores[idx]):
              index -= 1
              continue
          first_line = True
          while str_count(txt) >= img_w // font_size - 4:
              tmp = txt
              txt = tmp[: img_w // font_size - 4]
              if first_line:
                  new_txt = str(index) + ": " + txt
                  first_line = False
              else:
                  new_txt = "    " + txt
              draw_txt.text(
                  (0, gap * count), new_txt, txt_color, font=font
              )
              txt = tmp[img_w // font_size - 4 :]
              if count >= img_h // gap - 1:
                  txt_img_list.append(np.array(blank_img))
                  blank_img, draw_txt = create_blank_img()
                  count = 0
              count += 1
          if first_line:
              new_txt = (
                  str(index)
                  + ": "
                  + txt
                  + "   "
                  + "%.3f" % (scores[idx])
              )
          else:
              new_txt = "  " + txt + "  " + "%.3f" % (scores[idx])
          draw_txt.text((0, gap * count), new_txt, txt_color, font=font)
          # whether add new blank img or not
          if count >= img_h // gap - 1 and idx + 1 < len(texts):
              txt_img_list.append(np.array(blank_img))
              blank_img, draw_txt = create_blank_img()
              count = 0
          count += 1
      txt_img_list.append(np.array(blank_img))
      if len(txt_img_list) == 1:
          blank_img = np.array(txt_img_list[0])
      else:
          blank_img = np.concatenate(txt_img_list, axis=1)
      return np.array(blank_img)
  
imports: import argparse
  import os
  import sys
  import platform
  import cv2
  import numpy
  import paddle
  from PIL import Image, ImageDraw, ImageFont
  import math
  from paddle import inference
  import time
  import ast
label_desc: Use image node_id 10 for calling a global function with example usage: text_visual(texts, scores, img_h, img_w, threshold, font_path) and returns: np, blank_img,  draw_txt