code: def save_structure_res(res, save_folder, image_file):
      img = cv2.imread(image_file)
      excel_save_folder = os.path.join(
          save_folder, os.path.basename(image_file)
      )
      os.makedirs(excel_save_folder, exist_ok=True)
      # save res
      with open(
          os.path.join(excel_save_folder, "res.txt"),
          "w",
          encoding="utf8",
      ) as f:
          for region in res:
              if region["type"] == "Table":
                  excel_path = os.path.join(
                      excel_save_folder,
                      "{}.xlsx".format(region["bbox"]),
                  )
                  to_excel(region["res"], excel_path)
              elif region["type"] == "Figure":
                  x1, y1, x2, y2 = region["bbox"]
                  print(region["bbox"])
                  roi_img = img[y1:y2, x1:x2, :]
                  img_path = os.path.join(
                      excel_save_folder, "{}.jpg".format(region["bbox"])
                  )
                  cv2.imwrite(img_path, roi_img)
              else:
                  for text_result in region["res"]:
                      f.write("{}\n".format(json.dumps(text_result)))
  
file_path: PaddleOCR/tools/test_hubserving.py
imports: import os
  import sys
  from ppocr.utils.logging import get_logger
  import cv2
  import numpy
  import time
  from PIL import Image
  from ppocr.utils.utility import get_image_file_list
  from tools.infer.utility import draw_ocr, draw_boxes, str2bool
  from ppstructure.utility import draw_structure_result
  from ppstructure.predict_system import to_excel
  import requests
  import json
  import base64
label_desc: Use image node_id 3 for calling a global function with example usage: save_structure_res(res, save_folder, image_file) without return types