code: def parse_generation_parameters(x: str):
      """parses generation parameters string, the one you see in text field under the picture in UI:
      ```
      girl with an artist's beret, determined, blue eyes, desert scene, computer monitors, heavy makeup, by Alphonse Mucha and Charlie Bowater, ((eyeshadow)), (coquettish), detailed, intricate
      Negative prompt: ugly, fat, obese, chubby, (((deformed))), [blurry], bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), messy drawing
      Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model hash: 45dee52b
      ```
  
          returns a dict with field values
      """
  
      res = {}
  
      prompt = ""
      negative_prompt = ""
  
      done_with_prompt = False
  
      *lines, lastline = x.strip().split("\n")
      if len(re_param.findall(lastline)) < 3:
          lines.append(lastline)
          lastline = ""
  
      for line in lines:
          line = line.strip()
          if line.startswith("Negative prompt:"):
              done_with_prompt = True
              line = line[16:].strip()
          if done_with_prompt:
              negative_prompt += (
                  "" if negative_prompt == "" else "\n"
              ) + line
          else:
              prompt += ("" if prompt == "" else "\n") + line
  
      if shared.opts.infotext_styles != "Ignore":
          (
              found_styles,
              prompt,
              negative_prompt,
          ) = shared.prompt_styles.extract_styles_from_prompt(
              prompt, negative_prompt
          )
  
          if shared.opts.infotext_styles == "Apply":
              res["Styles array"] = found_styles
          elif (
              shared.opts.infotext_styles == "Apply if any"
              and found_styles
          ):
              res["Styles array"] = found_styles
  
      res["Prompt"] = prompt
      res["Negative prompt"] = negative_prompt
  
      for k, v in re_param.findall(lastline):
          try:
              if v[0] == '"' and v[-1] == '"':
                  v = unquote(v)
  
              m = re_imagesize.match(v)
              if m is not None:
                  res[f"{k}-1"] = m.group(1)
                  res[f"{k}-2"] = m.group(2)
              else:
                  res[k] = v
          except Exception:
              print(f'Error parsing "{k}: {v}"')
  
      # Missing CLIP skip means it was set to 1 (the default)
      if "Clip skip" not in res:
          res["Clip skip"] = "1"
  
      hypernet = res.get("Hypernet", None)
      if hypernet is not None:
          res[
              "Prompt"
          ] += f"""<hypernet:{hypernet}:{res.get("Hypernet strength", "1.0")}>"""
  
      if "Hires resize-1" not in res:
          res["Hires resize-1"] = 0
          res["Hires resize-2"] = 0
  
      if "Hires sampler" not in res:
          res["Hires sampler"] = "Use same sampler"
  
      if "Hires checkpoint" not in res:
          res["Hires checkpoint"] = "Use same checkpoint"
  
      if "Hires prompt" not in res:
          res["Hires prompt"] = ""
  
      if "Hires negative prompt" not in res:
          res["Hires negative prompt"] = ""
  
      restore_old_hires_fix_params(res)
  
      # Missing RNG means the default was set, which is GPU RNG
      if "RNG" not in res:
          res["RNG"] = "GPU"
  
      if "Schedule type" not in res:
          res["Schedule type"] = "Automatic"
  
      if "Schedule max sigma" not in res:
          res["Schedule max sigma"] = 0
  
      if "Schedule min sigma" not in res:
          res["Schedule min sigma"] = 0
  
      if "Schedule rho" not in res:
          res["Schedule rho"] = 0
  
      if "VAE Encoder" not in res:
          res["VAE Encoder"] = "Full"
  
      if "VAE Decoder" not in res:
          res["VAE Decoder"] = "Full"
  
      skip = set(shared.opts.infotext_skip_pasting)
      res = {k: v for k, v in res.items() if k not in skip}
  
      return res
  
imports: from __future__ import annotations
  import base64
  import io
  import json
  import os
  import re
  import gradio
  from modules.paths import data_path
  from modules import shared, ui_tempdir, script_callbacks, processing
  from PIL import Image
label_desc: Use image node_id 12 for calling a global function with example usage: parse_generation_parameters(x) and returns: res