adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
1.96k stars 253 forks source link

Treat 0 as a minimum value? {0-1$$} {0-3$$} #713

Open DivanoDova opened 5 months ago

DivanoDova commented 5 months ago

I tried to use this {0-1$$cars} and it always returns cars never choose a empty option even if i add low weight like {0-1$0.1::cars}

Is there no way to do this?

Edit: I updated dynamic prompts library and then i tried again.

No change for {0-1$$cars} it always return cars. But if i do this {0-1$$cars|bike} it will return cars or bike or nothing

DrJKL commented 3 months ago

How about {cars|bikes|}?

DivanoDova commented 3 weeks ago

Today i tried again after a long time: {0-2$$__background_details__} WORKS {0-2$$__background_details__,} Do not works (always returns a value) But i need "," for my prompt.

Examples: With: {0-2$$__background_details__} Raw Photo, DSLR, Return: streetlamp Raw Photo, DSLR, OR streetlamp, bench Raw Photo, DSLR, Or Raw Photo, DSLR, You can see here why "," is impoprtant

Of course i can use it like that {0-2$$__background_details__}, but then it can return this: ,Raw Photo, DSLR,

Look like "," is a issue

How about {cars|bikes|}?

If i use {0-1$$cars|bike} it works so i don't need the extra '"|"

{cars|bikes|} 33% Of chance of choosing any value {0-1$$cars|bike} 50% Of chance of choosing a value or nothing

akx commented 3 weeks ago

If you do always require a prompt between various background details (if any are emitted), you can specify a custom separator:

{0-2$$,$$__background_details__}

DivanoDova commented 3 weeks ago

If you do always require a prompt between various background details (if any are emitted), you can specify a custom separator:

{0-2$$,$$__background_details__}

Actually if i use this it's still return formated like this; streetlamp,bench Raw Photo, DSLR without a "," after the last value (bench in this case).

That's why i was thinking that this one will works {0-2$$__background_details__,} but no this one always return only one value never 0 and never 2 same goes for {0-2$$,$$__background_details__,}

What i'm trying to achieve is if nothing is selected my prompt continue Raw Photo, DSLR But if something is selected it will be formated like this streetlamp, Raw Photo, DSLR or streetlamp, bench, Raw Photo, DSLR