makepad/libs/flow/recipes/templates/prompt-to-image.splash
Admin 24c927ad7e flow-ui + widgets: every dropdown is the searchable ComboBox
Model and format pickers, the inspector's one-of rows, the Ask face's
choice and face-declared pickers all render as ComboBox; the popup and
its input map through the canvas zoom. ComboBoxRef gains changed_label
and set_selected_by_label so the bindings did not have to change shape.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 12:01:42 +02:00

42 lines
1.2 KiB
Text

use mod.flow.*
/** What to paint. */
let prompt = Input{ type: @text default: "a lighthouse at dusk" at: vec2(40, 120) }
let expand = Llm{
system: "Rewrite the prompt as one vivid paragraph for an image model.
Keep the subject. Add light, lens, material, mood. No lists."
prompt: prompt.text()
at: vec2(360, 120)
}
/** Appends the chosen style to the expanded prompt. */
let add_style = Fn{
in: { text: expand.text() style: "photo" }
out: [@text]
run: |i| { {text: i.text + ", " + i.style + " style"} }
at: vec2(680, 120)
ui: FnFace{
/* the style picker lives on the node whose input it sets */
style := ComboBox{
width: Fill height: 26
labels: ["photo", "anime", "oil paint"]
bind := "add_style.style"
}
}
}
let image = Image{
prompt: add_style.text()
width: 1024 height: 1024 steps: 8
at: vec2(1000, 120)
}
/** The finished picture. */
let picture = Output{ type: @image value: image.image() }
Flow{
label: "Prompt to image"
brief: "Expands a short prompt into a rich one and paints it."
prompt, expand, add_style, image, picture
}