Using the Compel package
Compel [1] is an open source text prompt-weighting and blending library developed and maintained by Damian Stewart. It is one of the easiest ways to enable blending prompts in Diffusers. This package also has the capability to apply weighting to prompts, similar to the solution we implemented in Chapter 10, but with a different weighting syntax. In this chapter, I will introduce the blending feature that can help us write a prompt to generate an image with two or more concepts blended.
Imagine that we want to create a photo that is half cat and half dog. How would we do it with prompts? Let’s say we simply give Stable Diffusion the following prompt:
A photo with half cat and half dog
Here are the lines of Python code (without using Compel):
import torch from diffusers import StableDiffusionPipeline pipeline = StableDiffusionPipeline.from_pretrained( Â Â Â Â "stablediffusionapi/deliberate-v2", Â Â Â &...