-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Init Image/Edit Image specific prompt and metadata for edit prompt #307
base: master
Are you sure you want to change the base?
Conversation
…edit image, but would work with init image as well. When a value is present in this prompt, the main prompt is ignored. This will also add `editprompt` to the list of metadata.
@@ -385,6 +385,9 @@ public static void RegisterDefaults() | |||
InitImage = Register<Image>(new("Init Image", "Init-image, to edit an image using diffusion.\nThis process is sometimes called 'img2img' or 'Image To Image'.", | |||
null, OrderPriority: -5, Group: GroupInitImage, ChangeWeight: 2 | |||
)); | |||
EditPrompt = Register<string>(new("Edit Prompt", "Prompt to use specifically for editing images.\nThis will override the main prompt when generating edited images.", | |||
"", OrderPriority: -4.9, Group: GroupInitImage, ViewType: ParamViewType.PROMPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs either a toggleable or an ignoreif empty. It should probably also be advanced (the average person doesn't need this).
@@ -333,7 +333,14 @@ public static void Register() | |||
#region Positive Prompt | |||
AddStep(g => | |||
{ | |||
g.FinalPrompt = g.CreateConditioning(g.UserInput.Get(T2IParamTypes.Prompt), g.FinalClip, g.UserInput.Get(T2IParamTypes.Model), true, "6"); | |||
if (g.UserInput.TryGet(T2IParamTypes.EditPrompt, out string editPrompt) && !string.IsNullOrWhiteSpace(editPrompt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if block shouldn't be duplicating the entire code inside, it's only changing one variable
It feels like it might be better here to just track the original prompt in metadata cleanly, rather than having a new parameter for edit prompt? When the init image was a generated image, copy the source prompt into metadata somewhere. |
Just wanted to say that I've been using this PR for a few days now, and it is really very handy to make quick edits without losing the initial prompt. I hope it will eventually be merged, as it is a great addition. |
Adds a prompt box for init image params, specifically for using with edit image, but would work with init image as well. When a value is present in this prompt, the main prompt is ignored.
This will also add
editprompt
to the list of metadata.This change is useful for when you have a long involved prompt as your main positive prompt, and you want to edit an image, but doesn't want to lose your prompt. This gives users a more ergonomic experience than both having a separate image2image tab AND having to replace your main prompt for every edit.
I suppose that this is sort of redundant if you are only doing img2img starting from a random picture dragged to the UI, but it is really useful when editing a generated image.
This was a pretty simple change, mostly to address #303 and my own needs. I'm more than open to discussing improvements or other approaches to this problem. I tested locally, and it seemed to work really well.