Spaces:
Runtime error
Runtime error
import gradio as gr | |
from optimum.intel import OVStableDiffusionPipeline | |
model_id = "helenai/eimiss-EimisAnimeDiffusion_1.0v-ov" | |
batch_size = 1 | |
num_images_per_prompt = 1 | |
height = 512 | |
width = 512 | |
pipeline = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False) | |
pipeline.sampler = "dpm++2s_a" | |
pipeline.to("CPU") | |
pipeline.reshape( batch_size=batch_size, height=height, width=width, num_images_per_prompt=num_images_per_prompt) | |
pipeline.compile() | |
def infer(prompt): | |
image = pipeline( | |
prompt=prompt, | |
width=width, | |
height=height, | |
num_inference_steps=28, | |
num_images_per_prompt=num_images_per_prompt, | |
).images[0] | |
return image | |
examples = [ | |
"Sailor Chibi Moon, Katsura Masakazu style", | |
"1girl, silver hair, symbol-shaped pupils, yellow eyes, smiling, light particles, light rays, wallpaper, star guardian, serious face, red inner hair, power aura, grandmaster1, golden and white clothes", | |
"A cute kitten, Tinkle style.", | |
"(illustration, 8k CG, extremely detailed),(whimsical),catgirl,teenage girl,playing in the snow,winter wonderland,snow-covered trees,soft pastel colors,gentle lighting,sparkling snow,joyful,magical atmosphere,highly detailed,fluffy cat ears and tail,intricate winter clothing,shallow depth of field,watercolor techniques,close-up shot,slightly tilted angle,fairy tale architecture,nostalgic,playful,winter magic,(masterpiece:2),best quality,ultra highres,original,extremely detailed,perfect lighting,", | |
] | |
css = """ | |
#col-container { | |
margin: 0 auto; | |
max-width: 520px; | |
} | |
""" | |
with gr.Blocks(css=css) as demo: | |
with gr.Column(elem_id="col-container"): | |
gr.Markdown("# Demo : helenai/eimiss-EimisAnimeDiffusion_1.0v-ov ⚡") | |
with gr.Row(): | |
prompt = gr.Text( | |
label="Prompt", | |
show_label=False, | |
placeholder="Enter your prompt", | |
container=False, | |
) | |
run_button = gr.Button("Run", scale=0) | |
result = gr.Image(label="Result", show_label=False) | |
gr.Examples( | |
examples = examples, | |
fn = infer, | |
inputs = [prompt], | |
outputs = [result] | |
) | |
run_button.click( | |
fn=infer, | |
inputs=[prompt], | |
outputs=[result] | |
) | |
demo.queue().launch(share=True) | |