
This is a script, so unzip it and put the contents in your scripts folder in the main stable-diffusion-webui folder.
It is called fprompt as it formats a prompt based on its content similar to fstring in C or string interpolation in Python. (It works in the negative prompt too!)
Flowframes is a good tool for stitching the pictures together into a smooth animation.
Just give it a folder with the images you want it to make a smooth animation from. You can pick the framerate and number of generated between frames.
Usage Guide
If you include the { } or [ ] constructs described below in your prompt and use the script:
-
You can specify the number of frames to spread the change over.
-
You can also specify the number of seeds to use in consecutive runs if you would like to automatically try multiple seeds with the same prompt.
-
The range inputs allow you to specify what DPoC (Decimal Percentage of Completion) range to generate prompts in. This is hard to explain, but makes sense if you mess with it some. It only creating the prompts that fall in that range without changing the scaling of everything else.
Formatting Syntax
“{<A>, <B>, [<start>=0, <end>=1, <cycles>=0.5]}” => a value ∈ [<A>, <B>] that:
-
= <A> when the DPoC < <start>,
-
smoothly goes from <A> to <B> and back again <cycles> times while DPoC ∈ [<start>, <end>], and
-
= the value it ended up on when DPoC = <end> when DPoC > <end>
[1;2; … :<A>,<B>,<start>,<end>] => a smoothly transitioning lerp between “;” separated token sets with a default value of <A> and a peak value of <B>
If the contents of a pair of parentheses can become a number when evaluated, resulting number will replace that string. This is the very last step, so { } constructs can be inside and will be evaluated properly. Since it is done recursively, you must replace internal () with <>. This allows you to use python builtins like round and int.
I also created the function curve(x, a) that takes an x value from 0 to 1 and optionally a flattening percentage (a): it actually returns (1-a)*sin(arccos(x))+a*x, which in simple terms is a curve that jumps up then grows more slowly. The flattening percentage is basically how much it is squished to a linear growth. 0-> quarter circle, 1 -> straight line
Examples
-
{0,1} smoothly goes from 0 to 1
-
{0,1,.5} is 0 for the first half of the prompts and smoothly goes from 0 to 1 in the second half
-
{0,1,0,.5} smoothly goes from 0 to 1 in the first half of the prompts then stays as 1 for the remainder of the prompts
-
{0,1,.25,.75,1} the value goes _/\_ as it is 0 for the first quarter, cycles up to 1 and back down in the range, then stays constant
-
[A;B;C:0,1.2,0,.5] => (A:{1.2,0,0,.25}), (B:{0,1.2,0,.5,1}), (C:{0,1.2,.25,.5})
-
(Example: (5 + (3 * 4 - 2))) => (Example: 15)
-
(Example: (int<4/3>) => (Example: 1)
-
(Example: (curve<{1,0}>)) => (Example: <x>) where x is a value that follows the edge of the 1st quadrant of the unit circle
-
(Example: (curve<{0,1}>)) => (Example: <x>) where x is a value that follows the edge of the 2nd quadrant of the unit circle
-
(Example: (1-curve<{0,1}>)) => (Example: <x>) where x is a value that follows the edge of the 3rd quadrant of the unit circle
-
(Example: (1-curve<{1,0}>)) => (Example: <x>) where x is a value that follows the edge of the 4th quadrant of the unit circle
-
(Example: (curve<{1,0}, 0.5>)) => (Example: <x>) where x is the average of curve<{1,0}> and {1,0}
-
cfg: {7,9} => is removed from the prompt and sets the cfg to a value that smoothly goes from 7 to 9 over all frames.
Disclaimer
Some LORAs respond very poorly to a value of 0, so there is an option to have them not appear when the value is 0 The same is available for parentheses enclosed strings, but that is more for length of prompt and has a significant impact on the consistency between frames
Img2Img
Loopback is available in Img2Img mode to significantly improve consistency between consecutive frames. Currently, some manual setup is required. Generate the first frame in Txt2Img mode then use that as the starting image. After that each frame will have the previous frame as its starting state. For my uses, a denoising strength of 0.6 - 0.7 works best, but that makes adjacent frames quite similar. At very low denoising strengths, the image is very likely to become highly distorted.
描述:
Currently supports { }, [ ], and ( ) parsing as described in the guide. It also stores the unformatted prompt as part of the PNG Info, so it can be retrieved later.
训练词语:
名称: fprompt_v10.zip
大小 (KB): 4
类型: Archive
Pickle 扫描结果: Success
Pickle 扫描信息: No Pickle imports
病毒扫描结果: Success