{
  "workflow_info": {
    "name": "Spiritual Teacher Avatar Generator",
    "description": "Generate avatar representations of spiritual teachers, gurus, and enlightened beings",
    "version": "1.0.0",
    "author": "Lilith Platform",
    "category": "avatar",
    "tags": [
      "teacher",
      "guru",
      "enlightened",
      "spiritual",
      "guide",
      "master"
    ],
    "estimated_time_seconds": 50,
    "gpu_requirement": "A5000"
  },
  "inputs": {
    "teacher_archetype": {
      "type": "enum",
      "options": [
        "buddhist_monk",
        "hindu_swami",
        "sufi_master",
        "zen_master",
        "tibetan_lama",
        "yoga_guru",
        "mystic_sage",
        "shaman",
        "ascended_master",
        "bodhisattva"
      ],
      "default": "mystic_sage",
      "description": "Type of spiritual teacher archetype"
    },
    "gender_presentation": {
      "type": "enum",
      "options": [
        "masculine",
        "feminine",
        "androgynous"
      ],
      "default": "androgynous",
      "description": "Gender presentation"
    },
    "age_appearance": {
      "type": "enum",
      "options": [
        "young_teacher",
        "middle_aged",
        "elder",
        "ancient",
        "ageless"
      ],
      "default": "ageless",
      "description": "Apparent age"
    },
    "expression": {
      "type": "enum",
      "options": [
        "serene_smile",
        "deep_meditation",
        "teaching",
        "blessing",
        "compassionate",
        "transcendent",
        "playful_wisdom"
      ],
      "default": "serene_smile",
      "description": "Facial expression and mood"
    },
    "setting": {
      "type": "enum",
      "options": [
        "meditation_cushion",
        "teaching_seat",
        "nature",
        "temple",
        "cave",
        "mountaintop",
        "cosmic",
        "simple_background"
      ],
      "default": "simple_background",
      "description": "Background setting"
    },
    "traditional_attire": {
      "type": "boolean",
      "default": true,
      "description": "Use tradition-specific attire"
    },
    "include_symbols": {
      "type": "boolean",
      "default": true,
      "description": "Include spiritual symbols and objects"
    },
    "aura_visible": {
      "type": "boolean",
      "default": true,
      "description": "Show visible enlightened aura"
    },
    "aura_intensity": {
      "type": "enum",
      "options": [
        "subtle",
        "moderate",
        "radiant",
        "blinding"
      ],
      "default": "moderate",
      "description": "Intensity of visible aura"
    },
    "art_style": {
      "type": "enum",
      "options": [
        "realistic",
        "painterly",
        "traditional_art",
        "ethereal",
        "iconic"
      ],
      "default": "painterly",
      "description": "Art style for rendering"
    },
    "seed": {
      "type": "integer",
      "default": -1,
      "description": "Random seed"
    },
    "width": {
      "type": "integer",
      "default": 512,
      "description": "Output width"
    },
    "height": {
      "type": "integer",
      "default": 512,
      "description": "Output height"
    },
    "steps": {
      "type": "integer",
      "default": 40,
      "description": "Sampling steps"
    },
    "cfg_scale": {
      "type": "float",
      "default": 7.5,
      "description": "CFG scale"
    },
    "hires_fix": {
      "type": "boolean",
      "default": true,
      "description": "Two-pass detail refinement: 1.5x latent upscale + low-denoise second sampling pass"
    },
    "freeu": {
      "type": "boolean",
      "default": true,
      "description": "FreeU v2 backbone re-weighting (family-tuned b1/b2/s1/s2)"
    },
    "checkpoint": {
      "type": "enum",
      "options": [
        "dreamshaper_8",
        "sd15_base"
      ],
      "default": "dreamshaper_8",
      "description": "SD1.5 checkpoint: DreamShaper 8 finetune (default, baked VAE) or base 1.5"
    },
    "face_detail": {
      "type": "boolean",
      "default": true,
      "description": "Impact FaceDetailer detect-and-inpaint refinement pass on detected faces"
    }
  },
  "archetype_prompts": {
    "buddhist_monk": "Buddhist monk teacher, saffron or maroon robes, shaved head, calm demeanor, dharma teacher, peaceful presence",
    "hindu_swami": "Hindu swami guru, orange robes, sacred marks, tilaka forehead, brahmin bearing, vedantic wisdom",
    "sufi_master": "Sufi mystic master, white robes, wisdom beard, dervish tradition, divine love embodiment, mystical presence",
    "zen_master": "Zen Buddhist master, simple robes, direct gaze, koanic presence, empty mind, satori embodiment",
    "tibetan_lama": "Tibetan Buddhist lama, maroon and gold robes, prayer beads, compassionate presence, vajrayana teacher",
    "yoga_guru": "Yoga master guru, minimal attire, flexible body, pranayama master, asana teacher, enlightened yogi",
    "mystic_sage": "universal mystic sage, transcendent wisdom, beyond traditions, pure consciousness, timeless teacher",
    "shaman": "shamanic teacher, indigenous wisdom, nature connection, spirit world access, healing presence",
    "ascended_master": "ascended master being, light body, ethereal presence, cosmic wisdom, divine messenger",
    "bodhisattva": "bodhisattva enlightened being, compassion embodiment, wisdom and skillful means, liberation guide"
  },
  "expression_prompts": {
    "serene_smile": "gentle serene smile, inner peace visible, knowing expression, quiet joy",
    "deep_meditation": "deep meditative state, eyes half-closed, absorption, samadhi presence",
    "teaching": "teaching expression, engaged and present, transmitting wisdom, attentive to student",
    "blessing": "blessing gesture, bestowing grace, divine transmission, spiritual empowerment",
    "compassionate": "deep compassion visible, loving kindness, caring presence, bodhicitta",
    "transcendent": "transcendent state, beyond ordinary, touching infinite, cosmic awareness",
    "playful_wisdom": "playful wise expression, crazy wisdom, unconventional teaching, joyful irreverence"
  },
  "setting_prompts": {
    "meditation_cushion": "seated on meditation cushion, zafu, practice space, intimate teaching setting",
    "teaching_seat": "on elevated teaching seat, dharma throne, addressing assembly, formal teaching",
    "nature": "natural outdoor setting, under tree, riverside, mountain meadow, nature teaching",
    "temple": "temple interior setting, sacred architecture, incense smoke, traditional space",
    "cave": "mountain cave setting, hermit dwelling, retreat space, solitary practice",
    "mountaintop": "mountaintop setting, high altitude, clear sky, transcendent location",
    "cosmic": "cosmic space setting, stars and galaxies, universal context, beyond earth",
    "simple_background": "simple clean background, focus on teacher, minimal distraction"
  },
  "attire_prompts": {
    "buddhist_monk": "traditional Buddhist robes, saffron or maroon, three robes, proper draping",
    "hindu_swami": "traditional swami attire, ochre dhoti, sacred thread, traditional marks",
    "sufi_master": "Sufi white robes, dervish hat, simple elegance, mystical attire",
    "zen_master": "Zen monk robes, black or gray, simple practical, unadorned",
    "tibetan_lama": "Tibetan Buddhist robes, maroon and yellow, ceremonial or daily, proper layers",
    "yoga_guru": "yoga attire, minimal covering, traditional dhoti or modern simple, practice ready",
    "mystic_sage": "universal sage robes, timeless garments, no specific tradition, simple flowing",
    "shaman": "shamanic attire, feathers and natural materials, ceremonial dress, power objects",
    "ascended_master": "light body garments, ethereal robes, luminous fabric, transcendent attire",
    "bodhisattva": "bodhisattva royal ornaments, celestial silks, peaceful deity attire, elaborate or simple"
  },
  "symbol_prompts": {
    "buddhist_monk": "Buddhist symbols, dharma wheel, lotus, prayer beads, bowl",
    "hindu_swami": "Hindu symbols, om symbol, trident, rudraksha, kamandalu pot",
    "sufi_master": "Sufi symbols, whirling imagery, heart symbolism, rose",
    "zen_master": "Zen symbols, enso circle, bamboo, minimalist objects",
    "tibetan_lama": "Tibetan Buddhist symbols, vajra dorje, bell, prayer wheel, kata scarf",
    "yoga_guru": "yoga symbols, lotus, chakra imagery, om, spiritual objects",
    "mystic_sage": "universal mystical symbols, sacred geometry, light symbols, cosmic imagery",
    "shaman": "shamanic power objects, drum, feathers, crystals, medicine bundle",
    "ascended_master": "ascended master symbols, violet flame, light rays, cosmic symbols",
    "bodhisattva": "bodhisattva attributes, lotus, wisdom sword, teaching mudras, symbolic objects"
  },
  "aura_prompts": {
    "subtle": "subtle gentle aura, soft light around, delicate presence, barely visible glow",
    "moderate": "moderate clear aura, visible light field, golden or white light, present but not overwhelming",
    "radiant": "radiant bright aura, strong light emission, powerful presence, clearly visible energy",
    "blinding": "blinding intense aura, overwhelming light, divine radiance, transcendent brightness"
  },
  "style_prompts": {
    "realistic": "photorealistic style, lifelike rendering, believable presence, detailed",
    "painterly": "painterly art style, visible brushwork, fine art quality, classical rendering",
    "traditional_art": "traditional religious art style, iconographic, thangka or icon inspired",
    "ethereal": "ethereal dreamlike style, soft focus, otherworldly, spiritual quality",
    "iconic": "iconic symbolic style, simplified powerful, recognizable, poster quality"
  },
  "nodes": {
    "1": {
      "class_type": "CheckpointLoaderSimple",
      "inputs": {
        "ckpt_name": "{{checkpoint_files[checkpoint]}}"
      },
      "outputs": [
        "MODEL",
        "CLIP",
        "VAE"
      ]
    },
    "2": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "{{constructed_prompt}}",
        "clip": [
          "1",
          1
        ]
      },
      "outputs": [
        "CONDITIONING"
      ]
    },
    "3": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "ugly, deformed, scary, dark evil, demonic, low quality, blurry, amateur, disrespectful, inappropriate, text watermark, celebrity face, specific real person",
        "clip": [
          "1",
          1
        ]
      },
      "outputs": [
        "CONDITIONING"
      ]
    },
    "4": {
      "class_type": "EmptyLatentImage",
      "inputs": {
        "width": "{{width}}",
        "height": "{{height}}",
        "batch_size": 1
      },
      "outputs": [
        "LATENT"
      ]
    },
    "5": {
      "class_type": "KSampler",
      "inputs": {
        "model": [
          "freeu",
          0
        ],
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "latent_image": [
          "4",
          0
        ],
        "seed": "{{seed}}",
        "steps": "{{steps}}",
        "cfg": "{{cfg_scale}}",
        "sampler_name": "dpmpp_2m_sde",
        "scheduler": "karras",
        "denoise": 1.0
      },
      "outputs": [
        "LATENT"
      ]
    },
    "6": {
      "class_type": "VAEDecode",
      "inputs": {
        "samples": [
          "hires_sampler",
          0
        ],
        "vae": [
          "1",
          2
        ]
      },
      "outputs": [
        "IMAGE"
      ]
    },
    "7": {
      "class_type": "SaveImage",
      "inputs": {
        "images": [
          "face_detailer",
          0
        ],
        "filename_prefix": "spiritual_teacher"
      },
      "outputs": []
    },
    "freeu": {
      "class_type": "FreeU_V2",
      "inputs": {
        "model": [
          "1",
          0
        ],
        "b1": 1.3,
        "b2": 1.4,
        "s1": 0.9,
        "s2": 0.2
      },
      "outputs": [
        "MODEL"
      ],
      "_condition": "{{freeu}}",
      "_comment": "FreeU v2 with known-good sd15 parameters."
    },
    "hires_upscale": {
      "class_type": "LatentUpscaleBy",
      "inputs": {
        "samples": [
          "5",
          0
        ],
        "upscale_method": "bislerp",
        "scale_by": 1.5
      },
      "outputs": [
        "LATENT"
      ],
      "_condition": "{{hires_fix}}"
    },
    "hires_sampler": {
      "class_type": "KSampler",
      "inputs": {
        "model": [
          "freeu",
          0
        ],
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "latent_image": [
          "hires_upscale",
          0
        ],
        "seed": "{{seed}}",
        "steps": 14,
        "cfg": "{{cfg_scale}}",
        "sampler_name": "dpmpp_2m",
        "scheduler": "karras",
        "denoise": 0.45
      },
      "outputs": [
        "LATENT"
      ],
      "_condition": "{{hires_fix}}",
      "_condition_passthrough": "latent_image",
      "_comment": "Hires second pass: refine structure from the 1.5x upscaled latent."
    },
    "face_bbox": {
      "class_type": "UltralyticsDetectorProvider",
      "inputs": {
        "model_name": "bbox/face_yolov8m.pt"
      },
      "outputs": [
        "BBOX_DETECTOR",
        "SEGM_DETECTOR"
      ],
      "_condition": "{{face_detail}}"
    },
    "face_detailer": {
      "class_type": "FaceDetailer",
      "inputs": {
        "image": [
          "6",
          0
        ],
        "model": [
          "freeu",
          0
        ],
        "clip": [
          "1",
          1
        ],
        "vae": [
          "1",
          2
        ],
        "guide_size": 512.0,
        "guide_size_for": true,
        "max_size": 1024.0,
        "seed": "{{seed}}",
        "steps": 20,
        "cfg": 7.0,
        "sampler_name": "dpmpp_2m",
        "scheduler": "karras",
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "denoise": 0.5,
        "feather": 5,
        "noise_mask": true,
        "force_inpaint": true,
        "bbox_threshold": 0.5,
        "bbox_dilation": 10,
        "bbox_crop_factor": 3.0,
        "sam_detection_hint": "center-1",
        "sam_dilation": 0,
        "sam_threshold": 0.93,
        "sam_bbox_expansion": 0,
        "sam_mask_hint_threshold": 0.7,
        "sam_mask_hint_use_negative": "False",
        "drop_size": 10,
        "bbox_detector": [
          "face_bbox",
          0
        ],
        "wildcard": "",
        "cycle": 1
      },
      "outputs": [
        "image",
        "cropped_refined",
        "cropped_enhanced_alpha",
        "mask",
        "detailer_pipe",
        "cnet_images"
      ],
      "_condition": "{{face_detail}}",
      "_condition_passthrough": "image",
      "_comment": "Impact FaceDetailer (SAM optional; bbox mask + feather fallback)."
    }
  },
  "prompt_construction": {
    "template": "spiritual teacher avatar, {archetype_prompt}, {gender_presentation} presentation, {age_appearance} appearance, {expression_prompt}, {setting_prompt}{attire_clause}{symbol_clause}{aura_clause}, {style_prompt}, respectful dignified portrayal, highly detailed, sacred art",
    "variables": {
      "archetype_prompt": "{{archetype_prompts[teacher_archetype]}}",
      "gender_presentation": "{{gender_presentation}}",
      "age_appearance": "{{age_appearance}}",
      "expression_prompt": "{{expression_prompts[expression]}}",
      "setting_prompt": "{{setting_prompts[setting]}}",
      "attire_clause": "{{', ' + attire_prompts[teacher_archetype] if traditional_attire else ', simple universal robes'}}",
      "symbol_clause": "{{', ' + symbol_prompts[teacher_archetype] if include_symbols else ''}}",
      "aura_clause": "{{', ' + aura_prompts[aura_intensity] + ' enlightened aura' if aura_visible else ''}}",
      "style_prompt": "{{style_prompts[art_style]}}"
    }
  },
  "output_spec": {
    "type": "image",
    "format": "png",
    "channels": 4
  },
  "custom_nodes_required": [
    "FaceDetailer",
    "UltralyticsDetectorProvider"
  ],
  "models_required": [
    "DreamShaper_8_pruned.safetensors",
    "bbox/face_yolov8m.pt",
    "v1-5-pruned-emaonly.safetensors"
  ],
  "checkpoint_files": {
    "dreamshaper_8": "DreamShaper_8_pruned.safetensors",
    "sd15_base": "v1-5-pruned-emaonly.safetensors"
  }
}
