SanskarModi commited on
Commit
77c7089
·
1 Parent(s): 252686e

fixing bug

Browse files
Files changed (1) hide show
  1. src/sdgen/ui/layout.py +40 -10
src/sdgen/ui/layout.py CHANGED
@@ -159,6 +159,44 @@ def _upscale_handler(
159
  return out_image, pretty_json(meta)
160
 
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  def build_ui(txt2img_pipes: dict, img2img_pipes: dict) -> gr.Blocks:
163
  """Build the entire Gradio UI."""
164
  with gr.Blocks() as demo:
@@ -178,19 +216,11 @@ def build_ui(txt2img_pipes: dict, img2img_pipes: dict) -> gr.Blocks:
178
  )
179
 
180
  txt_controls = build_txt2img_tab(
181
- handler=lambda model_name, *args: _txt2img_handler(
182
- model_name,
183
- txt2img_pipes,
184
- *args,
185
- ),
186
  )
187
 
188
  img_controls = build_img2img_tab(
189
- handler=lambda model_name, *args: _img2img_handler(
190
- model_name,
191
- img2img_pipes,
192
- *args,
193
- ),
194
  )
195
 
196
  build_upscaler_tab(
 
159
  return out_image, pretty_json(meta)
160
 
161
 
162
+ def make_img2img_handler(model_choice, pipes):
163
+ """Return handler for img2img generation."""
164
+
165
+ def handler(input_image, prompt, negative, strength, steps, guidance, seed):
166
+ return _img2img_handler(
167
+ model_choice,
168
+ pipes,
169
+ input_image,
170
+ prompt,
171
+ negative,
172
+ strength,
173
+ steps,
174
+ guidance,
175
+ seed,
176
+ )
177
+
178
+ return handler
179
+
180
+
181
+ def make_txt2img_handler(model_choice, pipes):
182
+ """Return handler for txt2img generation."""
183
+
184
+ def handler(prompt, negative, steps, guidance, width, height, seed):
185
+ return _txt2img_handler(
186
+ model_choice,
187
+ pipes,
188
+ prompt,
189
+ negative,
190
+ steps,
191
+ guidance,
192
+ width,
193
+ height,
194
+ seed,
195
+ )
196
+
197
+ return handler
198
+
199
+
200
  def build_ui(txt2img_pipes: dict, img2img_pipes: dict) -> gr.Blocks:
201
  """Build the entire Gradio UI."""
202
  with gr.Blocks() as demo:
 
216
  )
217
 
218
  txt_controls = build_txt2img_tab(
219
+ make_txt2img_handler(model_choice, txt2img_pipes),
 
 
 
 
220
  )
221
 
222
  img_controls = build_img2img_tab(
223
+ make_img2img_handler(model_choice, img2img_pipes),
 
 
 
 
224
  )
225
 
226
  build_upscaler_tab(