Spaces:
Runtime error
Runtime error
Download app.py from morgengc/Text2Image: direct link, hf CLI and curl.
- Browser
- Download file 417 Bytes
-
https://huggingface.co/spaces/morgengc/Text2Image/resolve/main/app.py
- Command line
-
hf download hf://spaces/morgengc/Text2Image/app.py
-
curl -L -o app.py https://huggingface.co/spaces/morgengc/Text2Image/resolve/main/app.py
417 Bytes
| from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
| model_id = "stabilityai/stable-diffusion-2" | |
| scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler") | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16) | |
| pipe = pipe.to("cuda") | |
| prompt = "a photo of an astronaut riding a horse on mars" | |
| image = pipe(prompt).images[0] | |