multimodalart HF staff commited on
Commit
acb6168
1 Parent(s): 7856e76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -34,7 +34,7 @@ def run(prompt, negative_prompt="", guidance_scale=7.0, pag_scale=3.0, randomize
34
 
35
  generator = torch.Generator(device="cuda").manual_seed(seed)
36
  image_normal = pipe(prompt, guidance_scale=guidance_scale, generator=generator, num_inference_steps=25).images[0]
37
- return image_pag, image_normal, seed
38
 
39
  css = '''
40
  .gradio-container{
@@ -51,13 +51,13 @@ with gr.Blocks(css=css, theme=theme) as demo:
51
  with gr.Row():
52
  prompt = gr.Textbox(show_label=False, scale=4, placeholder="Your prompt", info="Leave blank to test unconditional generation")
53
  button = gr.Button("Generate", min_width=120)
54
- output = ImageSlider(label="Your result image", interactive=False)
55
  with gr.Accordion("Advanced Settings", open=False):
56
  guidance_scale = gr.Number(label="Guidance Scale", value=7.0)
57
  pag_scale = gr.Number(label="Pag Scale", value=3.0)
58
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
59
  seed = gr.Slider(minimum=1, maximum=18446744073709551615, step=1, randomize=True)
60
- gr.Examples(fn=run, examples=["", "an insect robot preparing a delicious meal, anime style", "a photo of a group of friends at an amusement park"], inputs=prompt, outputs=output, cache_examples=True)
61
  gr.on(
62
  triggers=[
63
  button.click,
 
34
 
35
  generator = torch.Generator(device="cuda").manual_seed(seed)
36
  image_normal = pipe(prompt, guidance_scale=guidance_scale, generator=generator, num_inference_steps=25).images[0]
37
+ return (image_pag, image_normal), seed
38
 
39
  css = '''
40
  .gradio-container{
 
51
  with gr.Row():
52
  prompt = gr.Textbox(show_label=False, scale=4, placeholder="Your prompt", info="Leave blank to test unconditional generation")
53
  button = gr.Button("Generate", min_width=120)
54
+ output = ImageSlider(label="Left: PAG+CFG, Right: CFG", interactive=False)
55
  with gr.Accordion("Advanced Settings", open=False):
56
  guidance_scale = gr.Number(label="Guidance Scale", value=7.0)
57
  pag_scale = gr.Number(label="Pag Scale", value=3.0)
58
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
59
  seed = gr.Slider(minimum=1, maximum=18446744073709551615, step=1, randomize=True)
60
+ gr.Examples(fn=run, examples=["", "an insect robot preparing a delicious meal, anime style", "a photo of a group of friends at an amusement park"], inputs=prompt, outputs=[output, seed], cache_examples=True)
61
  gr.on(
62
  triggers=[
63
  button.click,