code: def wrap_gradio_gpu_call(func, extra_outputs=None):
      @wraps(func)
      def f(*args, **kwargs):
          # if the first argument is a string that says "task(...)", it is treated as a job id
          if (
              args
              and type(args[0]) == str
              and args[0].startswith("task(")
              and args[0].endswith(")")
          ):
              id_task = args[0]
              progress.add_task_to_queue(id_task)
          else:
              id_task = None
  
          with queue_lock:
              shared.state.begin(job=id_task)
              progress.start_task(id_task)
  
              try:
                  res = func(*args, **kwargs)
                  progress.record_results(id_task, res)
              finally:
                  progress.finish_task(id_task)
  
              shared.state.end()
  
          return res
  
      return wrap_gradio_call(
          f, extra_outputs=extra_outputs, add_stats=True
      )
  
imports: from functools import wraps
  import html
  import time
  from modules import shared, progress, errors, devices, fifo_lock
label_desc: Use image node_id 2 for calling a global function with example usage: wrap_gradio_gpu_call(func, extra_outputs) and returns: wrap_gradio_call, res