from constants import css
import gradio as gr
block = gr.Blocks(css=css)
with block:
gr.HTML(
"""
Evaluate Schedulers with StableDiffusionPipeline 🧨
This Space allows you to quantitatively compare different noise schedulers with a `StableDiffusionPipeline`.
One of the applications of this Space could be to evaluate different schedulers for a certain Stable Diffusion checkpoint for a fixed number of inference steps.
"""
)
with gr.Group():
with gr.Box():
with gr.Row(elem_id="prompt-container").style(equal_height=True):
with gr.Column():
text = gr.Textbox(
label="Enter your prompt",
show_label=False,
max_lines=1,
placeholder="Enter your prompt",
elem_id="prompt-text-input",
).style(
border=(True, False, True, True),
rounded=(True, False, False, True),
container=False,
)
negative = gr.Textbox(
label="Enter your negative prompt",
show_label=False,
max_lines=1,
placeholder="Enter a negative prompt",
elem_id="negative-prompt-text-input",
).style(
border=(True, False, True, True),
rounded=(True, False, False, True),
container=False,
)
btn = gr.Button("Generate image").style(
margin=False,
rounded=(False, True, True, False),
full_width=False,
)
gr.HTML(
"""
How it works?
The evaluator first sets a seed and then generates the initial noise which is passed as the initial latent to start the image generation process. It is done to ensure fair comparison.
This initial latent is used every time the pipeline is run (with different schedulers).
To quantify the quality of the generated images we use:
The default scheduler associated with the provided checkpoint is always used for reporting the scores.
Increasing both the number of images per prompt and the number of inference steps could quickly build up the inference queue and thus
resulting in slowdowns.