11---
22layout : post
3- title : AI text-to- image generation with diffused CLI
3+ title : AI image generation with diffused
44date : 2025-03-30 14:53:29
5- excerpt : How to perform AI text-to-image generation with diffused CLI.
6- categories : ai text-to-image cli diffused diffusion huggingface
5+ updated : 2025-04-07 12:06:43
6+ excerpt : How to perform AI image generation with diffused CLI.
7+ categories : ai image cli diffused diffusion huggingface
78---
89
9- This post goes over how to perform AI text-to- image generation with [ diffused] ( https://github.com/ai-action/diffused ) CLI.
10+ This post goes over how to perform AI image generation with [ diffused] ( https://github.com/ai-action/diffused ) CLI.
1011
1112## Prerequisites
1213
@@ -30,28 +31,28 @@ Install the [CLI](https://pypi.org/project/diffused/):
3031pipx install diffused
3132```
3233
33- Generate an image with [ model ] ( https://huggingface.co/segmind/tiny-sd ) and prompt :
34+ [ Text-to-image ] ( https://huggingface.co/docs/diffusers/using-diffusers/conditional_image_generation ) :
3435
3536``` sh
36- diffused segmind/tiny-sd " portrait of a cat "
37+ diffused segmind/tiny-sd " red apple "
3738```
3839
39- Generate an image with [ model ] ( https://huggingface.co/OFA-Sys/small-stable-diffusion-v0 ) , prompt, and filename :
40+ [ Image-to-image ] ( https://huggingface.co/docs/diffusers/using-diffusers/img2img ) :
4041
4142``` sh
42- diffused OFA-Sys/small-stable-diffusion-v0 " cartoon of a cat" --output cat.jpg
43+ diffused OFA-Sys/small-stable-diffusion-v0 " cat wizard " --image=https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ cat.png
4344```
4445
45- Generate an image with a specified size :
46+ [ Inpainting ] ( https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint ) :
4647
4748``` sh
48- diffused OFA-Sys/small-stable-diffusion-v0 " drawing of a cat" --width 1024 --height 1024
49+ diffused kandinsky-community/kandinsky-2-2-decoder-inpaint " black cat" --image=https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint.png --mask-image=https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint_mask.png
4950```
5051
51- See help for more info :
52+ Show the help message and exit :
5253
5354``` sh
54- diffused --help
55+ diffused --help # diffused -h
5556```
5657
5758## Script
@@ -80,8 +81,8 @@ Generate an image with [model](https://huggingface.co/segmind/tiny-sd) and promp
8081# script.py
8182from diffused import generate
8283
83- image = generate(model = " segmind/tiny-sd" , prompt = " apple" )
84- image .save(" apple.png" )
84+ images = generate(model = " segmind/tiny-sd" , prompt = " red apple" )
85+ images[ 0 ] .save(" apple.png" )
8586```
8687
8788Run the script:
@@ -90,7 +91,15 @@ Run the script:
9091python script.py
9192```
9293
94+ Open the image:
95+
96+ ``` sh
97+ open apple.png
98+ ```
99+
100+ See the [ API documentation] ( https://ai-action.github.io/diffused/diffused/generate.html ) .
101+
93102## Resources
94103
95- - For more models, see [ Hugging Face] ( https://huggingface.co/models?pipeline_tag=text-to-image ) .
104+ - For more models, see [ Hugging Face] ( https://huggingface.co/models ) .
96105- The package is open source and on [ GitHub] ( https://github.com/ai-action/diffused ) .
0 commit comments