code: def pipeline(
      model_dir=None,
      var_dict=None,
      optization_methods=None,
      scheduler=None,
      seed=-1,
      *args,
  ):
      kwargs = unpack_args(args)
      start_time = time.time()
  
      if var_dict is not None:
          ps = psutil.Process()
          ps.cpu_affinity(
              [i for i in range(1, multiprocessing.cpu_count())]
          )
          # no need to check StableDiffusionRunner here, because the instance created is not in the static memory field
          p = multiprocessing.current_process()
          image = p.runner._run(
              model_dir,
              optimization_methods=optization_methods,
              scheduler=scheduler,
              seed=seed,
              **kwargs,
          )
          time_cost = time.time() - start_time
          var_dict["image"], var_dict["time"] = image, time_cost
          return
      else:
          StableDiffusionRunner.initialize()
          image = StableDiffusionRunner.run(
              model_dir,
              optimization_methods=optization_methods,
              scheduler=scheduler,
              seed=seed,
              **kwargs,
          )
          time_cost = time.time() - start_time
          return image, time_cost
  
file_path: BigDL/python/nano/client-application/StableDiffusion/launch.py
imports: import gradio
  import os
  import multiprocessing
  import time
  import psutil
  from stable_diffusion.runner import StableDiffusionRunner
  from stable_diffusion.converter import convert
  from stable_diffusion.pipelines import NanoStableDiffusionPipeline
  from stable_diffusion.utils import get_snapshot_dir_from_model_version
  from stable_diffusion import runner_process
  import click
label_desc: Use image node_id 2 for calling a global function with example usage: pipeline(model_dir, var_dict, optization_methods, scheduler, seed) and returns: image,  time_cost