code: def run_extras(
      extras_mode,
      resize_mode,
      image,
      image_folder,
      input_dir,
      output_dir,
      show_extras_results,
      gfpgan_visibility,
      codeformer_visibility,
      codeformer_weight,
      upscaling_resize,
      upscaling_resize_w,
      upscaling_resize_h,
      upscaling_crop,
      extras_upscaler_1,
      extras_upscaler_2,
      extras_upscaler_2_visibility,
      upscale_first: bool,
      save_output: bool = True,
  ):
      """old handler for API"""
  
      args = scripts.scripts_postproc.create_args_for_run(
          {
              "Upscale": {
                  "upscale_mode": resize_mode,
                  "upscale_by": upscaling_resize,
                  "upscale_to_width": upscaling_resize_w,
                  "upscale_to_height": upscaling_resize_h,
                  "upscale_crop": upscaling_crop,
                  "upscaler_1_name": extras_upscaler_1,
                  "upscaler_2_name": extras_upscaler_2,
                  "upscaler_2_visibility": extras_upscaler_2_visibility,
              },
              "GFPGAN": {
                  "enable": True,
                  "gfpgan_visibility": gfpgan_visibility,
              },
              "CodeFormer": {
                  "enable": True,
                  "codeformer_visibility": codeformer_visibility,
                  "codeformer_weight": codeformer_weight,
              },
          }
      )
  
      return run_postprocessing(
          extras_mode,
          image,
          image_folder,
          input_dir,
          output_dir,
          show_extras_results,
          *args,
          save_output=save_output,
      )
  
imports: import os
  from PIL import Image
  from modules import shared, images, devices, scripts, scripts_postprocessing, ui_common, generation_parameters_copypaste
  from modules.shared import opts
label_desc: Use image node_id 3 for calling a global function with example usage: run_extras(extras_mode, resize_mode, image, image_folder, input_dir, output_dir, show_extras_results, gfpgan_visibility, codeformer_visibility, codeformer_weight, upscaling_resize, upscaling_resize_w, upscaling_resize_h, upscaling_crop, extras_upscaler_1, extras_upscaler_2, extras_upscaler_2_visibility, upscale_first, save_output) and returns: run_postprocessing