stable_diffusion / nvidia.py
Nedyalko Demirev
ezreal2211
e2aa61c
raw
history blame contribute delete
No virus
434 Bytes
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")