adirik / leditsplusplus

LEdits++ for image editing

  • Public
  • 776 runs
  • A100 (80GB)
  • GitHub
  • Paper
  • License
Iterate in playground

Input

image
*file

Input image to edit.

integer
(minimum: 1, maximum: 200)

Number of image inversion steps.

Default: 50

string
Shift + Return to add a new line

Prompt describing the input image that will be used for guidance during inversion. Guidance is disabled if the `source_prompt` is ``.

Default: ""

number
(minimum: 1, maximum: 25)

Strength of guidance during inversion.

Default: 3.5

number
(minimum: 0, maximum: 1)

Portion of initial steps that will be ignored for inversion and subsequent generation. Lower values will lead to stronger changes to the input image.

Default: 0.15

string
Shift + Return to add a new line

Negative prompt for the first text encoder to guide the image generation. *optional*, defaults to None.

string
Shift + Return to add a new line

Negative prompt for the second text encoder to guide the image generation. *optional*, defaults to None if *negative_prompt* is also left empty, alternatively defaults to *negative_prompt* otherwise.

string
Shift + Return to add a new line

Comma separated objects to add, remove or edit. Defaults to None, which inverts and reconstructs the input image.

string
Shift + Return to add a new line

Comma separated True or False boolean values indicating whether the corresponding prompt in `editing_prompts` should be increased or decreased to add, remove or edit. *optional*, defaults to `False`

string
Shift + Return to add a new line

Comma separated float values for each change specified in editing prompts list. *optional*, defaults to 5 if left empty.

integer
(minimum: 0, maximum: 100)

Number of diffusion steps (for each prompt) for which guidance is not applied

Default: 0

string
Shift + Return to add a new line

Comma separated edit threshold float values for each editing prompt, threshold values should be proportional to the image region that is modified. *optional*, defaults to 0.9 if left empty.

Output

output
Generated in

This output was created using a different version of the model, adirik/leditsplusplus:18916a95.

Run time and cost

This model costs approximately $0.039 to run on Replicate, or 25 runs per $1, but this varies depending on your inputs. It is also open source and you can run it on your own computer with Docker.

This model runs on Nvidia A100 (80GB) GPU hardware. Predictions typically complete within 28 seconds. The predict time for this model varies significantly based on the inputs.

Readme

LEdits++

LEdits++ is a textual image editing method for Stable Diffusion XL and variants. See the paper, Hugging Face demo and docs for details.

How to use the API

To edit an image with LEdits++, upload an image and specify the objects you would like to remove or add as a comma separated string. In order to edit an object in place (e.g. changing an apple to an orange), both nouns need to included in the editing_prompts as removal and addition targets respectively. The full list of API arguments are as follows:

  • image: Input image to edit.
  • num_inversion_steps: Number of image inversion steps to retrieve the image latent code.
  • negative_prompt: Negative prompt for the first text encoder to guide the image generation. optional, defaults to None.
  • source_prompt: Prompt describing the input image that will be used for guidance during inversion. Guidance is disabled if the source_prompt is "".
  • source_guidance_scale: Strength of guidance during inversion.
  • skip: Portion of initial steps that will be ignored for inversion and subsequent generation. Lower values will lead to stronger changes to the input image.
  • negative_prompt2: Negative prompt for the second text encoder to guide the image generation. optional, defaults to None if negative_prompt is also left empty, alternatively defaults to negative_prompt otherwise.
  • editing_prompts: Comma separated objects to add, remove or edit. Defaults to None, which inverts and reconstructs the input image.
  • reverse_editing_directions: Comma separated True or False boolean values indicating whether the corresponding prompt in editing_prompts should be increased or decreased to add, remove or edit. optional, defaults to False.
  • edit_guidance_scale: Comma separated float values for each change specified in editing prompts list. optional, defaults to 5 if left empty.
  • edit_warmup_steps: Number of diffusion steps (for each prompt) for which guidance is not applied.
  • edit_threshold: Comma separated edit threshold float values for each editing prompt, threshold values should be proportional to the image region that is modified. optional, defaults to 0.9 if left empty.

LEdits++ only supports DPMSolverMultistepScheduler (default) and DDIMScheduler. Images that are larger than 1024x1024 are downsampled while preserving the aspect ratio.

References

@article{Brack2023LEDITSLI,
  title={LEDITS++: Limitless Image Editing using Text-to-Image Models},
  author={Manuel Brack and Felix Friedrich and Katharina Kornmeier and Linoy Tsaban and Patrick Schramowski and Kristian Kersting and Apolin'ario Passos},
  journal={ArXiv},
  year={2023},
  volume={abs/2311.16711},
  url={https://api.semanticscholar.org/CorpusID:265466786}
}