| #!/bin/env python | |
| prompt = "sad girl in snow" | |
| imgname = "testimg.png" | |
| import torch | |
| from diffusers import StableDiffusionXLPipeline | |
| base_model: str = "opendiffusionai/sdxlone" | |
| pipe = StableDiffusionXLPipeline.from_pretrained( | |
| base_model) | |
| device = torch.device("cuda") | |
| pipe = pipe.to(device) | |
| print(f"Generating {imgname}") | |
| result = pipe(prompt, guidance_scale=7.5, num_inference_steps=30) | |
| image = result.images[0] | |
| image.save(imgname) | |