code: def do_upscale(self, img: PIL.Image.Image, selected_file):
      devices.torch_gc()
  
      try:
          model = self.load_model(selected_file)
      except Exception as e:
          print(
              f"ScuNET: Unable to load model from {selected_file}: {e}",
              file=sys.stderr,
          )
          return img
  
      device = devices.get_device_for("scunet")
      tile = opts.SCUNET_tile
      h, w = img.height, img.width
      np_img = np.array(img)
      np_img = np_img[:, :, ::-1]  # RGB to BGR
      np_img = np_img.transpose((2, 0, 1)) / 255  # HWC to CHW
      torch_img = torch.from_numpy(np_img).float().unsqueeze(0).to(device)  # type: ignore
  
      if tile > h or tile > w:
          _img = torch.zeros(
              1,
              3,
              max(h, tile),
              max(w, tile),
              dtype=torch_img.dtype,
              device=torch_img.device,
          )
          _img[:, :, :h, :w] = torch_img  # pad image
          torch_img = _img
  
      torch_output = self.tiled_inference(torch_img, model).squeeze(0)
      torch_output = torch_output[
          :, : h * 1, : w * 1
      ]  # remove padding, if any
      np_output: np.ndarray = (
          torch_output.float().cpu().clamp_(0, 1).numpy()
      )
      del torch_img, torch_output
      devices.torch_gc()
  
      output = np_output.transpose((1, 2, 0))  # CHW to HWC
      output = output[:, :, ::-1]  # BGR to RGB
      return PIL.Image.fromarray((output * 255).astype(np.uint8))
  
file_path: stable-diffusion-webui/extensions-builtin/ScuNET/scripts/scunet_model.py
imports: import sys
  import PIL.Image
  import numpy
  import torch
  from tqdm import tqdm
  import modules.upscaler
  from modules import devices, modelloader, script_callbacks, errors
  from scunet_model_arch import SCUNet
  from modules.modelloader import load_file_from_url
  from modules.shared import opts
label_desc: Use image node_id 3 for calling the UpscalerScuNET obj's underlying member method code with example usage: obj.do_upscale(img, selected_file) and returns: PIL, img