k-l-lambda commited on
Commit
43230a0
1 Parent(s): ac592b3

appy.py: added controlnet of lineart.

Browse files
Files changed (1) hide show
  1. app.py +25 -9
app.py CHANGED
@@ -135,6 +135,11 @@ CONTROLNET_DICT = dict(
135
  'strength': 1,
136
  'preprocessor': 'canny',
137
  },
 
 
 
 
 
138
  )
139
 
140
  last_check = 0
@@ -264,9 +269,7 @@ def generate_image (
264
  num_steps,
265
  identitynet_strength_ratio,
266
  adapter_strength_ratio,
267
- pose_strength,
268
- canny_strength,
269
- depth_strength,
270
  controlnet_selection,
271
  guidance_scale,
272
  seed,
@@ -305,9 +308,12 @@ def generate_image (
305
  width = int(width * scaling)
306
  height = int(height * scaling)
307
 
308
- CONTROLNET_DICT['pose']['strength'] = pose_strength
309
- CONTROLNET_DICT['canny']['strength'] = canny_strength
310
- CONTROLNET_DICT['depth']['strength'] = depth_strength
 
 
 
311
 
312
  face_image_uploaded, ref_image_uploaded = upload_assets_with_cache(client, [face_image_path, ref_image_path])
313
 
@@ -492,6 +498,13 @@ with gr.Blocks(css=css) as demo:
492
  step=0.05,
493
  value=0.40,
494
  )
 
 
 
 
 
 
 
495
  with gr.Accordion(open=False, label='Advanced Options'):
496
  negative_prompt = gr.Textbox(
497
  label='Negative Prompt',
@@ -567,9 +580,12 @@ with gr.Blocks(css=css) as demo:
567
  num_steps,
568
  identitynet_strength_ratio,
569
  adapter_strength_ratio,
570
- pose_strength,
571
- canny_strength,
572
- depth_strength,
 
 
 
573
  controlnet_selection,
574
  guidance_scale,
575
  seed,
 
135
  'strength': 1,
136
  'preprocessor': 'canny',
137
  },
138
+ lineart={
139
+ 'model_name': 'controlnet-softedge-dexined-sdxl-1.0',
140
+ 'strength': 1,
141
+ 'preprocessor': 'lineart',
142
+ },
143
  )
144
 
145
  last_check = 0
 
269
  num_steps,
270
  identitynet_strength_ratio,
271
  adapter_strength_ratio,
272
+ controlnet_strengths,
 
 
273
  controlnet_selection,
274
  guidance_scale,
275
  seed,
 
308
  width = int(width * scaling)
309
  height = int(height * scaling)
310
 
311
+ (
312
+ CONTROLNET_DICT['pose']['strength'],
313
+ CONTROLNET_DICT['canny']['strength'],
314
+ CONTROLNET_DICT['depth']['strength'],
315
+ CONTROLNET_DICT['lineart']['strength'],
316
+ ) = controlnet_strengths
317
 
318
  face_image_uploaded, ref_image_uploaded = upload_assets_with_cache(client, [face_image_path, ref_image_path])
319
 
 
498
  step=0.05,
499
  value=0.40,
500
  )
501
+ lineart_strength = gr.Slider(
502
+ label='Lineart strength',
503
+ minimum=0,
504
+ maximum=1.5,
505
+ step=0.05,
506
+ value=0.40,
507
+ )
508
  with gr.Accordion(open=False, label='Advanced Options'):
509
  negative_prompt = gr.Textbox(
510
  label='Negative Prompt',
 
580
  num_steps,
581
  identitynet_strength_ratio,
582
  adapter_strength_ratio,
583
+ [
584
+ pose_strength,
585
+ canny_strength,
586
+ depth_strength,
587
+ lineart_strength,
588
+ ],
589
  controlnet_selection,
590
  guidance_scale,
591
  seed,