code: def ui(self, is_img2img):
      with gr.Row(elem_id=self.elem_id("seed_row")):
          if cmd_opts.use_textbox_seed:
              self.seed = gr.Textbox(
                  label="Seed",
                  value="",
                  elem_id=self.elem_id("seed"),
                  min_width=100,
              )
          else:
              self.seed = gr.Number(
                  label="Seed",
                  value=-1,
                  elem_id=self.elem_id("seed"),
                  min_width=100,
                  precision=0,
              )
  
          random_seed = ToolButton(
              ui.random_symbol,
              elem_id=self.elem_id("random_seed"),
              tooltip="Set seed to -1, which will cause a new random number to be used every time",
          )
          reuse_seed = ToolButton(
              ui.reuse_symbol,
              elem_id=self.elem_id("reuse_seed"),
              tooltip="Reuse seed from last generation, mostly useful if it was randomized",
          )
  
          seed_checkbox = gr.Checkbox(
              label="Extra",
              elem_id=self.elem_id("subseed_show"),
              value=False,
          )
  
      with gr.Group(
          visible=False, elem_id=self.elem_id("seed_extras")
      ) as seed_extras:
          with gr.Row(elem_id=self.elem_id("subseed_row")):
              subseed = gr.Number(
                  label="Variation seed",
                  value=-1,
                  elem_id=self.elem_id("subseed"),
                  precision=0,
              )
              random_subseed = ToolButton(
                  ui.random_symbol,
                  elem_id=self.elem_id("random_subseed"),
              )
              reuse_subseed = ToolButton(
                  ui.reuse_symbol, elem_id=self.elem_id("reuse_subseed")
              )
              subseed_strength = gr.Slider(
                  label="Variation strength",
                  value=0.0,
                  minimum=0,
                  maximum=1,
                  step=0.01,
                  elem_id=self.elem_id("subseed_strength"),
              )
  
          with gr.Row(elem_id=self.elem_id("seed_resize_from_row")):
              seed_resize_from_w = gr.Slider(
                  minimum=0,
                  maximum=2048,
                  step=8,
                  label="Resize seed from width",
                  value=0,
                  elem_id=self.elem_id("seed_resize_from_w"),
              )
              seed_resize_from_h = gr.Slider(
                  minimum=0,
                  maximum=2048,
                  step=8,
                  label="Resize seed from height",
                  value=0,
                  elem_id=self.elem_id("seed_resize_from_h"),
              )
  
      random_seed.click(
          fn=None,
          _js="function(){setRandomSeed('"
          + self.elem_id("seed")
          + "')}",
          show_progress=False,
          inputs=[],
          outputs=[],
      )
      random_subseed.click(
          fn=None,
          _js="function(){setRandomSeed('"
          + self.elem_id("subseed")
          + "')}",
          show_progress=False,
          inputs=[],
          outputs=[],
      )
  
      seed_checkbox.change(
          lambda x: gr.update(visible=x),
          show_progress=False,
          inputs=[seed_checkbox],
          outputs=[seed_extras],
      )
  
      self.infotext_fields = [
          (self.seed, "Seed"),
          (
              seed_checkbox,
              lambda d: "Variation seed" in d
              or "Seed resize from-1" in d,
          ),
          (subseed, "Variation seed"),
          (subseed_strength, "Variation seed strength"),
          (seed_resize_from_w, "Seed resize from-1"),
          (seed_resize_from_h, "Seed resize from-2"),
      ]
  
      self.on_after_component(
          lambda x: connect_reuse_seed(
              self.seed, reuse_seed, x.component, False
          ),
          elem_id=f"generation_info_{self.tabname}",
      )
      self.on_after_component(
          lambda x: connect_reuse_seed(
              subseed, reuse_subseed, x.component, True
          ),
          elem_id=f"generation_info_{self.tabname}",
      )
  
      return (
          self.seed,
          seed_checkbox,
          subseed,
          subseed_strength,
          seed_resize_from_w,
          seed_resize_from_h,
      )
  
file_path: stable-diffusion-webui/modules/processing_scripts/seed.py
imports: import json
  import gradio
  from modules import scripts, ui, errors
  from modules.shared import cmd_opts
  from modules.ui_components import ToolButton
label_desc: Use image node_id 4 for calling the ScriptSeed obj's underlying member method code with example usage: obj.ui(is_img2img) and returns: self,  seed_checkbox,  subseed,  subseed_strength,  seed_resize_from_w,  seed_resize_from_h