Spaces:
Paused
Paused
Download sd.py from acmyu/KeyframesAI: direct link, hf CLI and curl.
- Browser
- Download file 495 Bytes
-
https://huggingface.co/spaces/acmyu/KeyframesAI/resolve/32da7a4538cb8f681d4dfd5e5ffa4fde6744e487/sd.py
- Command line
-
hf download hf://spaces/acmyu/KeyframesAI@32da7a4538cb8f681d4dfd5e5ffa4fde6744e487/sd.py
-
curl -L -o sd.py https://huggingface.co/spaces/acmyu/KeyframesAI/resolve/32da7a4538cb8f681d4dfd5e5ffa4fde6744e487/sd.py
495 Bytes
| from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
| import torch | |
| model_id = "stabilityai/stable-diffusion-2-1-base" | |
| scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler") | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16) | |
| pipe = pipe.to("cpu") | |
| prompt = "a photo of an astronaut riding a horse on mars" | |
| image = pipe(prompt).images[0] | |
| image.save("astronaut_rides_horse.png") |