code: def apply_refiner(
      input,
      state,
      sampler,
      num_samples,
      prompt,
      negative_prompt,
      filter=None,
      finish_denoising=False,
  ):
      init_dict = {
          "orig_width": input.shape[3] * 8,
          "orig_height": input.shape[2] * 8,
          "target_width": input.shape[3] * 8,
          "target_height": input.shape[2] * 8,
      }
  
      value_dict = init_dict
      value_dict["prompt"] = prompt
      value_dict["negative_prompt"] = negative_prompt
  
      value_dict["crop_coords_top"] = 0
      value_dict["crop_coords_left"] = 0
  
      value_dict["aesthetic_score"] = 6.0
      value_dict["negative_aesthetic_score"] = 2.5
  
      st.warning(f"refiner input shape: {input.shape}")
      samples = do_img2img(
          input,
          state["model"],
          sampler,
          value_dict,
          num_samples,
          skip_encode=True,
          filter=filter,
          add_noise=not finish_denoising,
      )
  
      return samples
  
imports: from pytorch_lightning import seed_everything
  from scripts.demo.streamlit_helpers import *
label_desc: Use image node_id 4 for calling a global function with example usage: apply_refiner(input, state, sampler, num_samples, prompt, negative_prompt, filter, finish_denoising) and returns: samples