import gradio as gr from optimum.intel.openvino import OVStableDiffusionPipeline pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-2-1-quantized", compile=False) pipe.reshape(batch_size=1, height=512, width=512, num_images_per_prompt=1) pipe.compile() prompt = "sailing ship in storm by Rembrandt" def greet(name): output = pipe(prompt, num_inference_steps=50, output_type="pil") output.images[0].save("result.png") return output.images[0] iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Prompt", default=prompt)], outputs=[gr.Image(type="pil")]) iface.launch()