Skip to content

Add Init Image/Edit Image specific prompt and metadata for edit prompt#307

Closed
aimerib wants to merge 3 commits intomcmonkeyprojects:masterfrom
aimerib:add-edit-image-prompt
Closed

Add Init Image/Edit Image specific prompt and metadata for edit prompt#307
aimerib wants to merge 3 commits intomcmonkeyprojects:masterfrom
aimerib:add-edit-image-prompt

Conversation

@aimerib
Copy link
Contributor

@aimerib aimerib commented Oct 5, 2024

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.

…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.
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
Copy link
Member

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).

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))
Copy link
Member

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

@mcmonkey4eva
Copy link
Member

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.
Not really sure.

@Michoko92
Copy link

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.

@Michoko92
Copy link

Is there still hope this PR will be merged or adapted, please? This is a very interesting feature, to be able to do inpainting iterations while keeping the original prompt of the main generation. Thank you! 🙂

@mcmonkey4eva
Copy link
Member

Closing for now as this has not been updated since 2024. Re-open if/when you want to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants