tools / +
patrickvonplaten's picture
[LCM] Better error message
a38f44b
raw
history blame contribute delete
658 Bytes
#!/usr/bin/env python3
from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained("SimianLuo/LCM_Dreamshaper_v7", dtype=torch.float16)
prompt = "A beautiful landscape of a snowy mountain"
num_inference_steps = 1
image = pipe(prompt=prompt, num_inference_steps=num_inference_steps, output_type="pil").images[0]
image.save("snow_mountain.png")
pipe = AutoPipelineForImage2Image.from_pipe(pipe)
prompt = "A beautiful landscape of a very red mountain"
image = pipe(prompt=prompt, image=image, num_inference_steps=10, strength=0.05, output_type="pil").images[0]
image.show()