docstr: Run as a service.
docstr_tok: ["Run","as","a","service","."]
code: def serving_method(self, images, **kwargs):
      """
      Run as a service.
      """
      images_decode = [base64_to_cv2(image) for image in images]
      results = self.predict(images_decode, **kwargs)
      res = []
      for result in results:
          if isinstance(result, dict):
              # result_new = dict()
              for key, value in result.items():
                  if isinstance(value, np.ndarray):
                      result[key] = cv2_to_base64(value)
                  elif isinstance(value, np.generic):
                      result[key] = np.asscalar(value)
  
          elif isinstance(result, list):
              for index in range(len(result)):
                  for key, value in result[index].items():
                      if isinstance(value, np.ndarray):
                          result[index][key] = cv2_to_base64(value)
                      elif isinstance(value, np.generic):
                          result[index][key] = np.asscalar(value)
          else:
              raise RuntimeError(
                  "The result cannot be used in serving."
              )
          res.append(result)
      return res
  
imports: from __future__ import absolute_import
  from __future__ import division
  import os
  import cv2
  import argparse
  import base64
  import paddlex
  from math import *
  import time, math, re
  import numpy
  import paddlehub
  from paddlehub.module.module import moduleinfo, runnable, serving
label_desc: Use image node_id 4 for calling the MODULE obj's underlying member method code with example usage: obj.serving_method(images) and returns: res