File size: 426 Bytes
8edcaf6
590bfd9
 
4d46150
590bfd9
 
4d46150
8edcaf6
590bfd9
8edcaf6
590bfd9
4d46150
590bfd9
8edcaf6
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
print("Start")
import torch
from diffusers import StableDiffusionPipeline

model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"

print("Init Pipeline")
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
print("Add device to pipeline")
pipe = pipe.to(device)

prompt = "a photo of an astronaut riding a horse on mars"
print("Generating image")
image = pipe(prompt).images[0]
print("Done")