From 2917434eeff134b15d10b9187468663212a739be Mon Sep 17 00:00:00 2001 From: Adi Eyal Date: Mon, 14 Aug 2023 11:50:14 +0200 Subject: [PATCH] Update jinja2.md --- jinja2.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jinja2.md b/jinja2.md index 28a745c..d0c7fdf 100644 --- a/jinja2.md +++ b/jinja2.md @@ -268,6 +268,16 @@ If you are using these templates, please let me know if they are useful. ## Cookbook +### Conditional Rendering +Render different prompts determined by a variable + +```jinja2 +{% with season = choice("winter", "summer") %} + {% set dress_color = "blue" if season == "winter" else "red" %} + A fashion model wearing a {{ dress_color }} dress +{% endwith %} +``` + ### [Prompt Editing](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#prompt-editing) ```jinja2