File size: 658 Bytes
a38f44b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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()