Image Guidance Scale is not working -> rollback

#5
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -49,7 +49,7 @@ def clear_all():
49
  return gr.update(value=None), gr.update(value=None), gr.update(value=[], visible=False), gr.update(visible=False), gr.update(visible=False)
50
 
51
  @spaces.GPU()
52
- def generate(image_editor, prompt, neg_prompt, versions, num_inference_steps, guidance_scale, image_guidance_scale):
53
  start = time.time()
54
  image = image_editor['background'].convert('RGB')
55
 
@@ -75,8 +75,7 @@ def generate(image_editor, prompt, neg_prompt, versions, num_inference_steps, gu
75
  image=image,
76
  mask_image=mask,
77
  num_inference_steps=num_inference_steps,
78
- guidance_scale=guidance_scale,
79
- image_guidance_scale=image_guidance_scale).images[0]
80
 
81
 
82
  # Make sure the longest side of image is 1024
@@ -107,7 +106,6 @@ def generate(image_editor, prompt, neg_prompt, versions, num_inference_steps, gu
107
  with gr.Blocks() as demo:
108
  gr.Markdown("""
109
  # Inpainting SD3 Sketch Pad
110
-
111
  Please ❤️ this Space
112
  """)
113
 
@@ -120,7 +118,6 @@ with gr.Blocks() as demo:
120
  neg_prompt = gr.Textbox(label='Negative Prompt', value='ugly, deformed')
121
  num_inference_steps = gr.Slider(minimum = 10, maximum = 100, value = 30, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality")
122
  guidance_scale = gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt")
123
- image_guidance_scale = gr.Slider(minimum = 1, value = 1.1, step = 0.1, label = "Image Guidance Scale", info = "lower=image quality, higher=follow the image")
124
  with gr.Column():
125
  version_gallery = gr.Gallery(label="Versions", type="pil", object_fit='contain', visible=False)
126
  restore_button = gr.Button("Restore Version", visible=False)
@@ -136,7 +133,7 @@ with gr.Blocks() as demo:
136
  # )
137
 
138
  version_gallery.select(get_select_index, None, selected)
139
- generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery, num_inference_steps, guidance_scale, image_guidance_scale], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
140
  restore_button.click(fn=restore_version, inputs=[selected, version_gallery], outputs=sketch_pad)
141
  clear_button.click(clear_all, inputs=None, outputs=[sketch_pad, prompt, version_gallery, restore_button, clear_button])
142
 
 
49
  return gr.update(value=None), gr.update(value=None), gr.update(value=[], visible=False), gr.update(visible=False), gr.update(visible=False)
50
 
51
  @spaces.GPU()
52
+ def generate(image_editor, prompt, neg_prompt, versions, num_inference_steps, guidance_scale):
53
  start = time.time()
54
  image = image_editor['background'].convert('RGB')
55
 
 
75
  image=image,
76
  mask_image=mask,
77
  num_inference_steps=num_inference_steps,
78
+ guidance_scale=guidance_scale).images[0]
 
79
 
80
 
81
  # Make sure the longest side of image is 1024
 
106
  with gr.Blocks() as demo:
107
  gr.Markdown("""
108
  # Inpainting SD3 Sketch Pad
 
109
  Please ❤️ this Space
110
  """)
111
 
 
118
  neg_prompt = gr.Textbox(label='Negative Prompt', value='ugly, deformed')
119
  num_inference_steps = gr.Slider(minimum = 10, maximum = 100, value = 30, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality")
120
  guidance_scale = gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt")
 
121
  with gr.Column():
122
  version_gallery = gr.Gallery(label="Versions", type="pil", object_fit='contain', visible=False)
123
  restore_button = gr.Button("Restore Version", visible=False)
 
133
  # )
134
 
135
  version_gallery.select(get_select_index, None, selected)
136
+ generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery, num_inference_steps, guidance_scale], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
137
  restore_button.click(fn=restore_version, inputs=[selected, version_gallery], outputs=sketch_pad)
138
  clear_button.click(clear_all, inputs=None, outputs=[sketch_pad, prompt, version_gallery, restore_button, clear_button])
139