Unconditional Image Generation

Code Example

INSTALL IT

!pip install diffusers transformers

IMPORT IT

from diffusers import DiffusionPipeline

generator = DiffusionPipeline.from_pretrained("anton-l/ddpm-butterflies-128")

MOVE TO GPU for faster Processing Time

[generator.to](<http://generator.to/>)("cuda")

GENERATE & TAKE FIRST IMAGE (0)

image = generator().images[0]

SAVE & OPEN GENERATED IMAGE

image.save("generated_image.png")
image

Text Guided Image Generation

Code Example

DIFFERENCE TO UNCONDITIONAL IMAGE GENERATION = Different Generator from (”runwayml…”) & a specific generation (”Prompt”) Prompt added to the image generation

INSTALL IT

!pip install diffusers transformers

IMPORT IT

from diffusers import DiffusionPipeline

generator = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")