stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Feature Request]: Allow order of operations on prompt parser

Open fcolecumberri opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Imagine the next prompt:

a cat AND a dog BREAK on a beach

Here this prompt can be parsed on 2 different ways:

1

a cat ━━━┓
         ┣━━┓
a dog ━━━┛  ┃
on a beach ━┻━━ OUTPUT

2

a cat ━━━━━━━━━━━┳━━ Output
a dog ━━━━━━━━┓  ┃
              ┣━━┛
on a beach ━━━┛

Both ways ends up with a different result. (drawing this ended up being more difficult than it looks) My proposal is to do something similar to how math works, by a parenthesis-equivalent keywords, something like BEGIN/END so by doing that, now:

BEGIN a cat AND a dog END BREAK on a beach

and

a cat AND BEGIN a dog BREAK on a beach END

This is also relevant since other extensions create their own keywords and usually collide since there is no way to express order of operations. Having a native to the tool way of doing it might force the extension developers to respect them as well.

Proposed workflow

No change on workflow, just a couple of keywords.

Additional information

No response

fcolecumberri avatar Sep 21 '24 10:09 fcolecumberri

[from:to:when] prompt syntax could be used for it.

for example [a cat:a dog:0.5] on a beach

see also https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#prompt-editing

wkpark avatar Sep 25 '24 14:09 wkpark

[from:to:when] prompt syntax could be used for it.

for example [a cat:a dog:0.5] on a beach

see also https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#prompt-editing

That could be a good hack for some cases, but that's not the same.

fcolecumberri avatar Oct 05 '24 08:10 fcolecumberri