AlexKoff88's picture
Create app.py
ca4f7e4
raw
history blame
880 Bytes
import gradio as gr
from optimum.intel.openvino import OVStableDiffusionPipeline
from diffusers.training_utils import set_seed
quantized_pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/Stable-Diffusion-Pokemon-en-quantized", compile=False)
quantized_pipe.reshape(batch_size=1, height=512, width=512, num_images_per_prompt=1)
quantized_pipe.compile()
prompt = "cartoon bird"
def generate(image):
output = pipe(prompt, num_inference_steps=50, output_type="pil")
return output.images[0]
gr.Interface(
fn=generate,
inputs=gr.inputs.Textbox(placeholder="cartoon bird",
label="Prompt"
"query",
lines=1),
outputs=gr.outputs.Image(type="auto", label="Generated Image"),
title="Quantized stable diffusion",
description="",
theme="huggingface",
).launch()