andite-anything-v4.0-ov / inference.py
helenai's picture
commit files to HF hub
f8aed5a
raw
history blame contribute delete
684 Bytes
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/andite-anything-v4.0-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")