from diffusers import StableDiffusionPipeline import torch def execute_nvidia(prompt, filename): DEVICE = 'cuda' model_id = "runwayml/stable-diffusion-v1-5" pipe = StableDiffusionPipeline.from_pretrained( model_id, use_auth_token=True, torch_dtype=torch.float16 ).to(DEVICE) pipe.enable_attention_slicing() image = pipe(prompt).images[0] image.save("pictures/"+ filename +".png")