Spaces:
Runtime error
Runtime error
Download model_test.py from next-social/9fo912: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/spaces/next-social/9fo912/resolve/main/model_test.py
- Command line
-
hf download hf://spaces/next-social/9fo912/model_test.py
-
curl -L -o model_test.py https://huggingface.co/spaces/next-social/9fo912/resolve/main/model_test.py
509 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, | |
| # safety_checker=None, | |
| revision="fp16") | |
| 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") |