Spaces:
Runtime error
Runtime error
File size: 761 Bytes
784b083 903b52c 784b083 903b52c 784b083 903b52c 784b083 f7ffa6d 784b083 f7ffa6d 784b083 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import json
from diffusers import DiffusionPipeline
import torch
import matplotlib.pyplot as plt
pipe = DiffusionPipeline.from_pretrained(
'stabilityai/stable-diffusion-xl-base-1.0',
torch_dtype=torch.float16,
use_safetensors=True,
variant='fp16',
)
pipe.to('cuda')
with open('../examples/prompts.json', 'r') as f:
prompts_list = list(json.load(f).values())
image_index = 4
prompt, negative_prompt = prompts_list[image_index]
images = pipe(
prompt=prompt,
height=1024,
width=1024,
negative_prompt=negative_prompt,
seed=0,
num_inference_steps=20,
guidance_scale=9.0,
).images[0]
images.save(fr'C:\Users\dragynir\Pictures\FASHION_IMAGES\no_condition\image_{image_index+1}.png')
plt.imshow(images)
plt.show()
|