from diffusers import StableDiffusionPipeline import gradio as gr pipe = StableDiffusionPipeline.from_pretrained("cjayic/late-stage-jerma") def inference(prompt, guidance, steps): all_images = [] images = pipe([prompt] * 1, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images all_images.extend(images) return all_images with gr.Blocks() as demo: with gr.Row(): with gr.Column(): prompt = gr.Textbox(label="prompt") guidance = gr.Slider(label="guidance scale", value=7.5, maximum=15) steps = gr.Slider(label="steps", value=50, maximum=100, minimum=2) run = gr.Button(value="Run") with gr.Column(): gallery = gr.Gallery(show_label=False) run.click(inference, inputs=[prompt, guidance, steps], outputs=gallery) gr.Examples([ ["a photo of sks jeremy elbertson disassembling the demon core", 7.5, 50], ["jeremy elbertson late victorian era portrait painting", 7.0, 75], ["realistic high-quality upper body portrait of a cyberpunk criminal in the red light district of night city, leaning back on their car, artstation front page, dramatic afternoon lighting, cityscape background", 4.4, 23], ["fantasy portrait painting, digital art", 4, 30], ], [prompt, guidance, steps], gallery, inference, cache_examples=False) demo.queue() demo.launch()