StableDiffusion
Last updated
Last updated
"Tools" has been fully upgraded to the "Plugins". For more details, please refer to . The content below has been archived.
Stable Diffusion is a tool for generating images based on text prompts, Dify has implemented the interface to access the Stable Diffusion WebUI API, so you can use it directly in Dify. followings are steps to integrate Stable Diffusion in Dify.
Stable Diffusion requires a machine with a GPU to generate images. but it's not necessary, you can just use CPU to generate images, but it will be slow.
Launch the Stable Diffusion WebUI on your local machine or server.
Clone the Stable Diffusion WebUI repository from the
After cloning the repository, you should change directory to the cloned repository and run the following command to launch the Stable Diffusion WebUI.
Now you can access the Stable Diffusion WebUI on your browser according to the address shown in the terminal, but the models are not available yet. You need to download the models HuggingFace or other sources and put them in the models
directory of the Stable Diffusion WebUI.
Now you can see pastel-mix
in the model list, but we still need to get the model name, visit http://your_id:port/sdapi/v1/sd-models
, you will see the model name like below.
The model_name
is what we need, in this case, it's pastel-mix_pastelmix-better-vae-fp32
.
Fill in the Authentication and Model Configuration in Tools > StableDiffusion > To Authorize
with the information you get from the previous steps.
Chatflow / Workflow Applications
Agent Applications
Add the Stable Diffusion
tool in the Agent application, then send image descriptions in the chat box to invoke the tool and generate AI images.
For example, we use as the model, use git lfs
to download the model and put it in the models
directory in stable-diffusion-webui
.
Both Chatflow and Workflow applications support adding Stable Diffusion
tool nodes. After adding, you need to fill in the referencing the user's input prompt or the content generated by the previous node in the "Input Variables → Prompt" section within the node. Finally, use a variable to reference the image output by Stable Diffusion
in the "End" node.