helenai's picture
commit files to HF hub
8eb858e
from optimum.intel.openvino.modeling_diffusion import OVStableDiffusionPipeline
batch_size = 1
num_images_per_prompt = 1
height = 256
width = 256
# load the model and reshape to static shapes for faster inference
model_id = "helenai/hakurei-waifu-diffusion-ov"
stable_diffusion = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
stable_diffusion.reshape( batch_size=batch_size, height=height, width=width, num_images_per_prompt=num_images_per_prompt)
stable_diffusion.compile()
# generate image!
prompt = "a random image"
images = stable_diffusion(prompt, height=height, width=width, num_images_per_prompt=num_images_per_prompt).images
images[0].save("result.png")