code: def make_batch_sd(
      image,
      txt,
      device,
      num_samples=1,
  ):
      image = np.array(image.convert("RGB"))
      image = (
          torch.from_numpy(image).to(dtype=torch.float32) / 127.5 - 1.0
      )
      batch = {
          "lr": rearrange(image, "h w c -> 1 c h w"),
          "txt": num_samples * [txt],
      }
      batch["lr"] = repeat(
          batch["lr"].to(device=device), "1 ... -> n ...", n=num_samples
      )
      return batch
  
file_path: StableDiffusion/scripts/gradio/superresolution.py
imports: import sys
  import torch
  import numpy
  import gradio
  from PIL import Image
  from omegaconf import OmegaConf
  from einops import repeat, rearrange
  from pytorch_lightning import seed_everything
  from imwatermark import WatermarkEncoder
  from scripts.txt2img import put_watermark
  from ldm.models.diffusion.ddim import DDIMSampler
  from ldm.models.diffusion.ddpm import LatentUpscaleDiffusion, LatentUpscaleFinetuneDiffusion
  from ldm.util import exists, instantiate_from_config
label_desc: Use image node_id 2 for calling a global function with example usage: make_batch_sd(image, txt, device, num_samples) and returns: batch