CoolFace
Apppublic

acmyu/KeyframesAI

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
sd.py13 linesDownload Raw Back to root
1from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
2import torch
3
4model_id = "stabilityai/stable-diffusion-2-1-base"
5
6scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
7pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
8pipe = pipe.to("cpu")
9
10prompt = "a photo of an astronaut riding a horse on mars"
11image = pipe(prompt).images[0]  
12    
13image.save("astronaut_rides_horse.png")