RioShiina commited on
Commit
b2fb908
·
verified ·
1 Parent(s): 5654651

Upload folder using huggingface_hub

Browse files
chain_injectors/anima_controlnet_lllite_injector.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def inject(assembler, chain_definition, chain_items):
2
+ if not chain_items:
3
+ return
4
+
5
+ ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
6
+ if ksampler_name not in assembler.node_map:
7
+ print(f"Warning: KSampler node '{ksampler_name}' not found for Anima LLLite chain. Skipping.")
8
+ return
9
+
10
+ ksampler_id = assembler.node_map[ksampler_name]
11
+
12
+ if 'model' not in assembler.workflow[ksampler_id]['inputs']:
13
+ print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping.")
14
+ return
15
+
16
+ current_model_connection = assembler.workflow[ksampler_id]['inputs']['model']
17
+
18
+ for item_data in chain_items:
19
+ image_loader_id = assembler._get_unique_id()
20
+ image_loader_node = assembler._get_node_template("LoadImage")
21
+ image_loader_node['inputs']['image'] = item_data['image']
22
+ assembler.workflow[image_loader_id] = image_loader_node
23
+
24
+ image_scaler_id = assembler._get_unique_id()
25
+ image_scaler_node = assembler._get_node_template("ImageScaleToTotalPixels")
26
+ image_scaler_node['inputs']['image'] = [image_loader_id, 0]
27
+ image_scaler_node['inputs']['upscale_method'] = 'nearest-exact'
28
+ image_scaler_node['inputs']['megapixels'] = 1.0
29
+ assembler.workflow[image_scaler_id] = image_scaler_node
30
+
31
+ apply_cn_id = assembler._get_unique_id()
32
+ apply_cn_node = assembler._get_node_template("AnimaLLLiteApply")
33
+
34
+ apply_cn_node['inputs']['lllite_name'] = item_data['control_net_name']
35
+ apply_cn_node['inputs']['strength'] = item_data['strength']
36
+ apply_cn_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
37
+ apply_cn_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)
38
+
39
+ apply_cn_node['inputs']['model'] = current_model_connection
40
+ apply_cn_node['inputs']['image'] = [image_scaler_id, 0]
41
+
42
+ assembler.workflow[apply_cn_id] = apply_cn_node
43
+
44
+ current_model_connection = [apply_cn_id, 0]
45
+
46
+ assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connection
47
+
48
+ print(f"Anima LLLite injector applied. KSampler model input re-routed through {len(chain_items)} LLLite(s).")
comfy_integration/setup.py CHANGED
@@ -74,6 +74,14 @@ def initialize_comfyui():
74
  else:
75
  print("✅ ComfyUI-Newbie-Nodes extension already exists.")
76
 
 
 
 
 
 
 
 
 
77
  print(f"✅ Current working directory is: {os.getcwd()}")
78
 
79
  import comfy.model_management
 
74
  else:
75
  print("✅ ComfyUI-Newbie-Nodes extension already exists.")
76
 
77
+ # 5. ComfyUI-Anima-LLLite
78
+ anima_controlnet_lllite_nodes_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-Anima-LLLite")
79
+ if not os.path.exists(anima_controlnet_lllite_nodes_path):
80
+ os.system(f"git clone https://github.com/kohya-ss/ComfyUI-Anima-LLLite.git {anima_controlnet_lllite_nodes_path}")
81
+ print("✅ ComfyUI-Anima-LLLite extension cloned.")
82
+ else:
83
+ print("✅ ComfyUI-Anima-LLLite extension already exists.")
84
+
85
  print(f"✅ Current working directory is: {os.getcwd()}")
86
 
87
  import comfy.model_management
core/pipelines/sd_image_pipeline.py CHANGED
@@ -287,7 +287,24 @@ class SdImagePipeline(BasePipeline):
287
  "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
288
  "start_percent": 0.0, "end_percent": 1.0, "control_net_name": cn_filepaths[i]
289
  })
290
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  diffsynth_controlnet_data = ui_inputs.get('diffsynth_controlnet_data', [])
292
  active_diffsynth_controlnets = []
293
  if diffsynth_controlnet_data:
@@ -482,7 +499,8 @@ class SdImagePipeline(BasePipeline):
482
  "vae_name": ui_inputs.get('vae_name'),
483
  "guidance": ui_inputs.get('guidance', 3.5),
484
  "lora_chain": active_loras_for_gpu,
485
- "controlnet_chain": active_controlnets,
 
486
  "diffsynth_controlnet_chain": active_diffsynth_controlnets,
487
  "ipadapter_chain": active_ipadapters,
488
  "flux1_ipadapter_chain": active_flux1_ipadapters,
 
287
  "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
288
  "start_percent": 0.0, "end_percent": 1.0, "control_net_name": cn_filepaths[i]
289
  })
290
+
291
+ anima_controlnet_lllite_data = ui_inputs.get('anima_controlnet_lllite_data', [])
292
+ active_anima_controlnets = []
293
+ if anima_controlnet_lllite_data:
294
+ (cn_images, _, _, cn_strengths, cn_filepaths, cn_starts, cn_ends) = [anima_controlnet_lllite_data[i::7] for i in range(7)]
295
+ for i in range(len(cn_images)):
296
+ if cn_images[i] and cn_strengths[i] > 0 and cn_filepaths[i] and cn_filepaths[i] != "None":
297
+ from utils.app_utils import _ensure_model_downloaded
298
+ _ensure_model_downloaded(cn_filepaths[i], progress)
299
+ if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
300
+ cn_temp_path = os.path.join(INPUT_DIR, f"temp_anima_cn_{i}_{random.randint(1000, 9999)}.png")
301
+ cn_images[i].save(cn_temp_path, "PNG")
302
+ temp_files_to_clean.append(cn_temp_path)
303
+ active_anima_controlnets.append({
304
+ "image": os.path.basename(cn_temp_path), "strength": cn_strengths[i],
305
+ "start_percent": cn_starts[i], "end_percent": cn_ends[i], "control_net_name": cn_filepaths[i]
306
+ })
307
+
308
  diffsynth_controlnet_data = ui_inputs.get('diffsynth_controlnet_data', [])
309
  active_diffsynth_controlnets = []
310
  if diffsynth_controlnet_data:
 
499
  "vae_name": ui_inputs.get('vae_name'),
500
  "guidance": ui_inputs.get('guidance', 3.5),
501
  "lora_chain": active_loras_for_gpu,
502
+ "controlnet_chain": active_controlnets if not active_anima_controlnets else [],
503
+ "anima_controlnet_lllite_chain": active_anima_controlnets,
504
  "diffsynth_controlnet_chain": active_diffsynth_controlnets,
505
  "ipadapter_chain": active_ipadapters,
506
  "flux1_ipadapter_chain": active_flux1_ipadapters,
core/pipelines/workflow_recipes/_partials/conditioning/anima.yaml CHANGED
@@ -43,6 +43,10 @@ dynamic_lora_chains:
43
  "model": ["ksampler:model"]
44
  "clip": ["pos_prompt:clip", "neg_prompt:clip"]
45
 
 
 
 
 
46
  dynamic_conditioning_chains:
47
  conditioning_chain:
48
  ksampler_node: "ksampler"
 
43
  "model": ["ksampler:model"]
44
  "clip": ["pos_prompt:clip", "neg_prompt:clip"]
45
 
46
+ dynamic_anima_controlnet_lllite_chains:
47
+ anima_controlnet_lllite_chain:
48
+ ksampler_node: "ksampler"
49
+
50
  dynamic_conditioning_chains:
51
  conditioning_chain:
52
  ksampler_node: "ksampler"
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- comfyui-frontend-package==1.42.15
2
- comfyui-workflow-templates==0.9.66
3
  comfyui-embedded-docs==0.4.4
4
  torch==2.10.0
5
  torchsde
 
1
+ comfyui-frontend-package==1.43.17
2
+ comfyui-workflow-templates==0.9.69
3
  comfyui-embedded-docs==0.4.4
4
  torch==2.10.0
5
  torchsde
ui/events.py CHANGED
@@ -51,6 +51,38 @@ def get_cn_defaults(arch_val):
51
 
52
  return all_types, default_type, series_choices, default_series, filepath
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  @lru_cache(maxsize=1)
55
  def load_diffsynth_controlnet_config():
56
  _PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -338,6 +370,98 @@ def attach_event_handlers(ui_components, demo):
338
  show_progress=False
339
  )
340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  def create_diffsynth_controlnet_event_handlers(prefix):
342
  cn_rows = ui_components.get(f'diffsynth_controlnet_rows_{prefix}')
343
  if not cn_rows: return
@@ -711,6 +835,7 @@ def attach_event_handlers(ui_components, demo):
711
 
712
  lora_data_components = ui_components.get(f'all_lora_components_flat_{prefix}', [])
713
  controlnet_data_components = ui_components.get(f'all_controlnet_components_flat_{prefix}', [])
 
714
  diffsynth_controlnet_data_components = ui_components.get(f'all_diffsynth_controlnet_components_flat_{prefix}', [])
715
  ipadapter_data_components = ui_components.get(f'all_ipadapter_components_flat_{prefix}', [])
716
  sd3_ipadapter_data_components = ui_components.get(f'all_sd3_ipadapter_components_flat_{prefix}', [])
@@ -727,7 +852,7 @@ def attach_event_handlers(ui_components, demo):
727
  input_keys = list(run_inputs_map.keys())
728
  input_list_flat = [v for v in run_inputs_map.values() if v is not None]
729
  all_chains = [
730
- lora_data_components, controlnet_data_components, diffsynth_controlnet_data_components, ipadapter_data_components,
731
  sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,
732
  embedding_data_components, conditioning_data_components, reference_latent_data_components
733
  ]
@@ -748,6 +873,7 @@ def attach_event_handlers(ui_components, demo):
748
 
749
  assign_chain_data('lora_data', lora_data_components)
750
  assign_chain_data('controlnet_data', controlnet_data_components)
 
751
  assign_chain_data('diffsynth_controlnet_data', diffsynth_controlnet_data_components)
752
  assign_chain_data('ipadapter_data', ipadapter_data_components)
753
  assign_chain_data('sd3_ipadapter_chain', sd3_ipadapter_data_components)
@@ -768,7 +894,7 @@ def attach_event_handlers(ui_components, demo):
768
  outputs=[res_gal]
769
  )
770
 
771
- def make_update_fn(m_comp, cat_comp, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, ipa_preset, lora_acc, cn_acc, diffsynth_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
772
  def update_fn(*args):
773
  arch = args[0]
774
  category = args[1]
@@ -810,6 +936,7 @@ def attach_event_handlers(ui_components, demo):
810
 
811
  if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
812
  if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
 
813
  if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
814
  if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
815
  if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
@@ -844,6 +971,14 @@ def attach_event_handlers(ui_components, demo):
844
  updates[s_comp] = gr.update(choices=series_choices, value=default_series)
845
  for f_comp in cn_filepaths:
846
  updates[f_comp] = filepath
 
 
 
 
 
 
 
 
847
 
848
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
849
  for t_comp in diffsynth_cn_types:
@@ -873,7 +1008,7 @@ def attach_event_handlers(ui_components, demo):
873
  return updates
874
  return update_fn
875
 
876
- def make_model_change_fn(cat_comp_ref, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, diffsynth_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
877
  def change_fn(*args):
878
  model_name = args[0]
879
  idx = 1
@@ -919,6 +1054,7 @@ def attach_event_handlers(ui_components, demo):
919
 
920
  if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
921
  if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
 
922
  if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
923
  if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
924
  if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
@@ -953,6 +1089,14 @@ def attach_event_handlers(ui_components, demo):
953
  updates[s_comp] = gr.update(choices=series_choices, value=default_series)
954
  for f_comp in cn_filepaths:
955
  updates[f_comp] = filepath
 
 
 
 
 
 
 
 
956
 
957
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
958
  for t_comp in diffsynth_cn_types:
@@ -1001,12 +1145,17 @@ def attach_event_handlers(ui_components, demo):
1001
  cn_series_list = ui_components.get(f'controlnet_series_{prefix}', [])
1002
  cn_filepaths_list = ui_components.get(f'controlnet_filepaths_{prefix}', [])
1003
 
 
 
 
 
1004
  diffsynth_cn_types_list = ui_components.get(f'diffsynth_controlnet_types_{prefix}', [])
1005
  diffsynth_cn_series_list = ui_components.get(f'diffsynth_controlnet_series_{prefix}', [])
1006
  diffsynth_cn_filepaths_list = ui_components.get(f'diffsynth_controlnet_filepaths_{prefix}', [])
1007
 
1008
  lora_accordion = ui_components.get(f'lora_accordion_{prefix}')
1009
  cn_accordion = ui_components.get(f'controlnet_accordion_{prefix}')
 
1010
  diffsynth_cn_accordion = ui_components.get(f'diffsynth_controlnet_accordion_{prefix}')
1011
  ipa_accordion = ui_components.get(f'ipadapter_accordion_{prefix}')
1012
  sd3_ipa_accordion = ui_components.get(f'sd3_ipadapter_accordion_{prefix}')
@@ -1034,9 +1183,11 @@ def attach_event_handlers(ui_components, demo):
1034
  if guidance_comp: outputs.append(guidance_comp)
1035
  if aspect_ratio_comp: outputs.append(aspect_ratio_comp)
1036
  outputs.extend(cn_types_list + cn_series_list + cn_filepaths_list)
 
1037
  outputs.extend(diffsynth_cn_types_list + diffsynth_cn_series_list + diffsynth_cn_filepaths_list)
1038
  if lora_accordion: outputs.append(lora_accordion)
1039
  if cn_accordion: outputs.append(cn_accordion)
 
1040
  if diffsynth_cn_accordion: outputs.append(diffsynth_cn_accordion)
1041
  if ipa_accordion: outputs.append(ipa_accordion)
1042
  if sd3_ipa_accordion: outputs.append(sd3_ipa_accordion)
@@ -1052,8 +1203,9 @@ def attach_event_handlers(ui_components, demo):
1052
  update_fn = make_update_fn(
1053
  model_comp, cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,
1054
  cn_types_list, cn_series_list, cn_filepaths_list,
 
1055
  diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
1056
- ipa_preset_list, lora_accordion, cn_accordion, diffsynth_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
1057
  ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
1058
  )
1059
  inputs = [arch_comp, cat_comp]
@@ -1070,9 +1222,11 @@ def attach_event_handlers(ui_components, demo):
1070
  if guidance_comp: outputs2.append(guidance_comp)
1071
  if aspect_ratio_comp: outputs2.append(aspect_ratio_comp)
1072
  outputs2.extend(cn_types_list + cn_series_list + cn_filepaths_list)
 
1073
  outputs2.extend(diffsynth_cn_types_list + diffsynth_cn_series_list + diffsynth_cn_filepaths_list)
1074
  if lora_accordion: outputs2.append(lora_accordion)
1075
  if cn_accordion: outputs2.append(cn_accordion)
 
1076
  if diffsynth_cn_accordion: outputs2.append(diffsynth_cn_accordion)
1077
  if ipa_accordion: outputs2.append(ipa_accordion)
1078
  if sd3_ipa_accordion: outputs2.append(sd3_ipa_accordion)
@@ -1093,14 +1247,16 @@ def attach_event_handlers(ui_components, demo):
1093
  change_fn = make_model_change_fn(
1094
  cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,
1095
  cn_types_list, cn_series_list, cn_filepaths_list,
 
1096
  diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
1097
- arch_comp, ipa_preset_list, lora_accordion, cn_accordion, diffsynth_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
1098
  ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
1099
  )
1100
  model_comp.change(fn=change_fn, inputs=inputs2, outputs=outputs2)
1101
 
1102
  create_lora_event_handlers(prefix)
1103
  create_controlnet_event_handlers(prefix)
 
1104
  create_diffsynth_controlnet_event_handlers(prefix)
1105
  create_ipadapter_event_handlers(prefix)
1106
  create_embedding_event_handlers(prefix)
@@ -1159,6 +1315,7 @@ def attach_event_handlers(ui_components, demo):
1159
  controlnet_key = architectures_dict.get(default_m_type, {}).get("controlnet_key", default_m_type)
1160
 
1161
  all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
 
1162
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
1163
 
1164
  updates = {}
@@ -1170,6 +1327,14 @@ def attach_event_handlers(ui_components, demo):
1170
  updates[series_dd] = gr.update(choices=series_choices, value=default_series)
1171
  for filepath_state in ui_components[f'controlnet_filepaths_{prefix}']:
1172
  updates[filepath_state] = filepath
 
 
 
 
 
 
 
 
1173
 
1174
  if f'diffsynth_controlnet_types_{prefix}' in ui_components:
1175
  for type_dd in ui_components[f'diffsynth_controlnet_types_{prefix}']:
@@ -1224,6 +1389,10 @@ def attach_event_handlers(ui_components, demo):
1224
  all_load_outputs.extend(ui_components[f'controlnet_types_{prefix}'])
1225
  all_load_outputs.extend(ui_components[f'controlnet_series_{prefix}'])
1226
  all_load_outputs.extend(ui_components[f'controlnet_filepaths_{prefix}'])
 
 
 
 
1227
  if f'diffsynth_controlnet_types_{prefix}' in ui_components:
1228
  all_load_outputs.extend(ui_components[f'diffsynth_controlnet_types_{prefix}'])
1229
  all_load_outputs.extend(ui_components[f'diffsynth_controlnet_series_{prefix}'])
 
51
 
52
  return all_types, default_type, series_choices, default_series, filepath
53
 
54
+ @lru_cache(maxsize=1)
55
+ def load_anima_controlnet_lllite_config():
56
+ _PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
57
+ _CN_MODEL_LIST_PATH = os.path.join(_PROJECT_ROOT, 'yaml', 'anima_controlnet_lllite_models.yaml')
58
+ try:
59
+ print("--- Loading anima_controlnet_lllite_models.yaml ---")
60
+ with open(_CN_MODEL_LIST_PATH, 'r', encoding='utf-8') as f:
61
+ config = yaml.safe_load(f)
62
+ print("--- ✅ anima_controlnet_lllite_models.yaml loaded successfully ---")
63
+ return config.get("Anima_ControlNet_Lllite", [])
64
+ except Exception as e:
65
+ print(f"Error loading anima_controlnet_lllite_models.yaml: {e}")
66
+ return []
67
+
68
+ def get_anima_cn_defaults():
69
+ cn_config = load_anima_controlnet_lllite_config()
70
+ if not cn_config:
71
+ return [], None, [], None, "None"
72
+ all_types = sorted(list(set(t for model in cn_config for t in model.get("Type", []))))
73
+ default_type = all_types[0] if all_types else None
74
+ series_choices = []
75
+ if default_type:
76
+ series_choices = sorted(list(set(model.get("Series", "Default") for model in cn_config if default_type in model.get("Type", []))))
77
+ default_series = series_choices[0] if series_choices else None
78
+ filepath = "None"
79
+ if default_series and default_type:
80
+ for model in cn_config:
81
+ if model.get("Series") == default_series and default_type in model.get("Type", []):
82
+ filepath = model.get("Filepath")
83
+ break
84
+ return all_types, default_type, series_choices, default_series, filepath
85
+
86
  @lru_cache(maxsize=1)
87
  def load_diffsynth_controlnet_config():
88
  _PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
370
  show_progress=False
371
  )
372
 
373
+ def create_anima_controlnet_lllite_event_handlers(prefix):
374
+ cn_rows = ui_components.get(f'anima_controlnet_lllite_rows_{prefix}')
375
+ if not cn_rows: return
376
+ cn_types = ui_components[f'anima_controlnet_lllite_types_{prefix}']
377
+ cn_series = ui_components[f'anima_controlnet_lllite_series_{prefix}']
378
+ cn_filepaths = ui_components[f'anima_controlnet_lllite_filepaths_{prefix}']
379
+ cn_images = ui_components[f'anima_controlnet_lllite_images_{prefix}']
380
+ cn_strengths = ui_components[f'anima_controlnet_lllite_strengths_{prefix}']
381
+
382
+ count_state = ui_components[f'anima_controlnet_lllite_count_state_{prefix}']
383
+ add_button = ui_components[f'add_anima_controlnet_lllite_button_{prefix}']
384
+ del_button = ui_components[f'delete_anima_controlnet_lllite_button_{prefix}']
385
+ accordion = ui_components[f'anima_controlnet_lllite_accordion_{prefix}']
386
+
387
+ def add_cn_row(c):
388
+ c += 1
389
+ updates = {
390
+ count_state: c,
391
+ cn_rows[c-1]: gr.update(visible=True),
392
+ add_button: gr.update(visible=c < MAX_CONTROLNETS),
393
+ del_button: gr.update(visible=True)
394
+ }
395
+ return updates
396
+
397
+ def del_cn_row(c):
398
+ c -= 1
399
+ updates = {
400
+ count_state: c,
401
+ cn_rows[c]: gr.update(visible=False),
402
+ cn_images[c]: None,
403
+ cn_strengths[c]: 1.0,
404
+ add_button: gr.update(visible=True),
405
+ del_button: gr.update(visible=c > 0)
406
+ }
407
+ return updates
408
+
409
+ add_outputs = [count_state, add_button, del_button] + cn_rows
410
+ del_outputs = [count_state, add_button, del_button] + cn_rows + cn_images + cn_strengths
411
+ add_button.click(fn=add_cn_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
412
+ del_button.click(fn=del_cn_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
413
+
414
+ def on_cn_type_change(selected_type):
415
+ cn_config = load_anima_controlnet_lllite_config()
416
+ series_choices = []
417
+ if selected_type:
418
+ series_choices = sorted(list(set(
419
+ model.get("Series", "Default") for model in cn_config
420
+ if selected_type in model.get("Type", [])
421
+ )))
422
+ default_series = series_choices[0] if series_choices else None
423
+ filepath = "None"
424
+ if default_series:
425
+ for model in cn_config:
426
+ if model.get("Series") == default_series and selected_type in model.get("Type", []):
427
+ filepath = model.get("Filepath")
428
+ break
429
+ return gr.update(choices=series_choices, value=default_series), filepath
430
+
431
+ def on_cn_series_change(selected_series, selected_type):
432
+ cn_config = load_anima_controlnet_lllite_config()
433
+ filepath = "None"
434
+ if selected_series and selected_type:
435
+ for model in cn_config:
436
+ if model.get("Series") == selected_series and selected_type in model.get("Type", []):
437
+ filepath = model.get("Filepath")
438
+ break
439
+ return filepath
440
+
441
+ for i in range(MAX_CONTROLNETS):
442
+ cn_types[i].change(
443
+ fn=on_cn_type_change,
444
+ inputs=[cn_types[i]],
445
+ outputs=[cn_series[i], cn_filepaths[i]],
446
+ show_progress=False
447
+ )
448
+ cn_series[i].change(
449
+ fn=on_cn_series_change,
450
+ inputs=[cn_series[i], cn_types[i]],
451
+ outputs=[cn_filepaths[i]],
452
+ show_progress=False
453
+ )
454
+
455
+ def on_accordion_expand(*images):
456
+ return [gr.update() for _ in images]
457
+
458
+ accordion.expand(
459
+ fn=on_accordion_expand,
460
+ inputs=cn_images,
461
+ outputs=cn_images,
462
+ show_progress=False
463
+ )
464
+
465
  def create_diffsynth_controlnet_event_handlers(prefix):
466
  cn_rows = ui_components.get(f'diffsynth_controlnet_rows_{prefix}')
467
  if not cn_rows: return
 
835
 
836
  lora_data_components = ui_components.get(f'all_lora_components_flat_{prefix}', [])
837
  controlnet_data_components = ui_components.get(f'all_controlnet_components_flat_{prefix}', [])
838
+ anima_controlnet_lllite_data_components = ui_components.get(f'all_anima_controlnet_lllite_components_flat_{prefix}', [])
839
  diffsynth_controlnet_data_components = ui_components.get(f'all_diffsynth_controlnet_components_flat_{prefix}', [])
840
  ipadapter_data_components = ui_components.get(f'all_ipadapter_components_flat_{prefix}', [])
841
  sd3_ipadapter_data_components = ui_components.get(f'all_sd3_ipadapter_components_flat_{prefix}', [])
 
852
  input_keys = list(run_inputs_map.keys())
853
  input_list_flat = [v for v in run_inputs_map.values() if v is not None]
854
  all_chains = [
855
+ lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, ipadapter_data_components,
856
  sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,
857
  embedding_data_components, conditioning_data_components, reference_latent_data_components
858
  ]
 
873
 
874
  assign_chain_data('lora_data', lora_data_components)
875
  assign_chain_data('controlnet_data', controlnet_data_components)
876
+ assign_chain_data('anima_controlnet_lllite_data', anima_controlnet_lllite_data_components)
877
  assign_chain_data('diffsynth_controlnet_data', diffsynth_controlnet_data_components)
878
  assign_chain_data('ipadapter_data', ipadapter_data_components)
879
  assign_chain_data('sd3_ipadapter_chain', sd3_ipadapter_data_components)
 
894
  outputs=[res_gal]
895
  )
896
 
897
+ def make_update_fn(m_comp, cat_comp, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
898
  def update_fn(*args):
899
  arch = args[0]
900
  category = args[1]
 
936
 
937
  if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
938
  if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
939
+ if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
940
  if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
941
  if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
942
  if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
 
971
  updates[s_comp] = gr.update(choices=series_choices, value=default_series)
972
  for f_comp in cn_filepaths:
973
  updates[f_comp] = filepath
974
+
975
+ anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
976
+ for t_comp in anima_cn_types:
977
+ updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
978
+ for s_comp in anima_cn_series:
979
+ updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
980
+ for f_comp in anima_cn_filepaths:
981
+ updates[f_comp] = anima_filepath
982
 
983
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
984
  for t_comp in diffsynth_cn_types:
 
1008
  return updates
1009
  return update_fn
1010
 
1011
+ def make_model_change_fn(cat_comp_ref, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
1012
  def change_fn(*args):
1013
  model_name = args[0]
1014
  idx = 1
 
1054
 
1055
  if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
1056
  if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
1057
+ if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
1058
  if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
1059
  if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
1060
  if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
 
1089
  updates[s_comp] = gr.update(choices=series_choices, value=default_series)
1090
  for f_comp in cn_filepaths:
1091
  updates[f_comp] = filepath
1092
+
1093
+ anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
1094
+ for t_comp in anima_cn_types:
1095
+ updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
1096
+ for s_comp in anima_cn_series:
1097
+ updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
1098
+ for f_comp in anima_cn_filepaths:
1099
+ updates[f_comp] = anima_filepath
1100
 
1101
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
1102
  for t_comp in diffsynth_cn_types:
 
1145
  cn_series_list = ui_components.get(f'controlnet_series_{prefix}', [])
1146
  cn_filepaths_list = ui_components.get(f'controlnet_filepaths_{prefix}', [])
1147
 
1148
+ anima_cn_types_list = ui_components.get(f'anima_controlnet_lllite_types_{prefix}', [])
1149
+ anima_cn_series_list = ui_components.get(f'anima_controlnet_lllite_series_{prefix}', [])
1150
+ anima_cn_filepaths_list = ui_components.get(f'anima_controlnet_lllite_filepaths_{prefix}', [])
1151
+
1152
  diffsynth_cn_types_list = ui_components.get(f'diffsynth_controlnet_types_{prefix}', [])
1153
  diffsynth_cn_series_list = ui_components.get(f'diffsynth_controlnet_series_{prefix}', [])
1154
  diffsynth_cn_filepaths_list = ui_components.get(f'diffsynth_controlnet_filepaths_{prefix}', [])
1155
 
1156
  lora_accordion = ui_components.get(f'lora_accordion_{prefix}')
1157
  cn_accordion = ui_components.get(f'controlnet_accordion_{prefix}')
1158
+ anima_cn_accordion = ui_components.get(f'anima_controlnet_lllite_accordion_{prefix}')
1159
  diffsynth_cn_accordion = ui_components.get(f'diffsynth_controlnet_accordion_{prefix}')
1160
  ipa_accordion = ui_components.get(f'ipadapter_accordion_{prefix}')
1161
  sd3_ipa_accordion = ui_components.get(f'sd3_ipadapter_accordion_{prefix}')
 
1183
  if guidance_comp: outputs.append(guidance_comp)
1184
  if aspect_ratio_comp: outputs.append(aspect_ratio_comp)
1185
  outputs.extend(cn_types_list + cn_series_list + cn_filepaths_list)
1186
+ outputs.extend(anima_cn_types_list + anima_cn_series_list + anima_cn_filepaths_list)
1187
  outputs.extend(diffsynth_cn_types_list + diffsynth_cn_series_list + diffsynth_cn_filepaths_list)
1188
  if lora_accordion: outputs.append(lora_accordion)
1189
  if cn_accordion: outputs.append(cn_accordion)
1190
+ if anima_cn_accordion: outputs.append(anima_cn_accordion)
1191
  if diffsynth_cn_accordion: outputs.append(diffsynth_cn_accordion)
1192
  if ipa_accordion: outputs.append(ipa_accordion)
1193
  if sd3_ipa_accordion: outputs.append(sd3_ipa_accordion)
 
1203
  update_fn = make_update_fn(
1204
  model_comp, cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,
1205
  cn_types_list, cn_series_list, cn_filepaths_list,
1206
+ anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
1207
  diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
1208
+ ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
1209
  ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
1210
  )
1211
  inputs = [arch_comp, cat_comp]
 
1222
  if guidance_comp: outputs2.append(guidance_comp)
1223
  if aspect_ratio_comp: outputs2.append(aspect_ratio_comp)
1224
  outputs2.extend(cn_types_list + cn_series_list + cn_filepaths_list)
1225
+ outputs2.extend(anima_cn_types_list + anima_cn_series_list + anima_cn_filepaths_list)
1226
  outputs2.extend(diffsynth_cn_types_list + diffsynth_cn_series_list + diffsynth_cn_filepaths_list)
1227
  if lora_accordion: outputs2.append(lora_accordion)
1228
  if cn_accordion: outputs2.append(cn_accordion)
1229
+ if anima_cn_accordion: outputs2.append(anima_cn_accordion)
1230
  if diffsynth_cn_accordion: outputs2.append(diffsynth_cn_accordion)
1231
  if ipa_accordion: outputs2.append(ipa_accordion)
1232
  if sd3_ipa_accordion: outputs2.append(sd3_ipa_accordion)
 
1247
  change_fn = make_model_change_fn(
1248
  cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,
1249
  cn_types_list, cn_series_list, cn_filepaths_list,
1250
+ anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
1251
  diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
1252
+ arch_comp, ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
1253
  ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
1254
  )
1255
  model_comp.change(fn=change_fn, inputs=inputs2, outputs=outputs2)
1256
 
1257
  create_lora_event_handlers(prefix)
1258
  create_controlnet_event_handlers(prefix)
1259
+ create_anima_controlnet_lllite_event_handlers(prefix)
1260
  create_diffsynth_controlnet_event_handlers(prefix)
1261
  create_ipadapter_event_handlers(prefix)
1262
  create_embedding_event_handlers(prefix)
 
1315
  controlnet_key = architectures_dict.get(default_m_type, {}).get("controlnet_key", default_m_type)
1316
 
1317
  all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
1318
+ anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
1319
  diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
1320
 
1321
  updates = {}
 
1327
  updates[series_dd] = gr.update(choices=series_choices, value=default_series)
1328
  for filepath_state in ui_components[f'controlnet_filepaths_{prefix}']:
1329
  updates[filepath_state] = filepath
1330
+
1331
+ if f'anima_controlnet_lllite_types_{prefix}' in ui_components:
1332
+ for type_dd in ui_components[f'anima_controlnet_lllite_types_{prefix}']:
1333
+ updates[type_dd] = gr.update(choices=anima_all_types, value=anima_default_type)
1334
+ for series_dd in ui_components[f'anima_controlnet_lllite_series_{prefix}']:
1335
+ updates[series_dd] = gr.update(choices=anima_series_choices, value=anima_default_series)
1336
+ for filepath_state in ui_components[f'anima_controlnet_lllite_filepaths_{prefix}']:
1337
+ updates[filepath_state] = anima_filepath
1338
 
1339
  if f'diffsynth_controlnet_types_{prefix}' in ui_components:
1340
  for type_dd in ui_components[f'diffsynth_controlnet_types_{prefix}']:
 
1389
  all_load_outputs.extend(ui_components[f'controlnet_types_{prefix}'])
1390
  all_load_outputs.extend(ui_components[f'controlnet_series_{prefix}'])
1391
  all_load_outputs.extend(ui_components[f'controlnet_filepaths_{prefix}'])
1392
+ if f'anima_controlnet_lllite_types_{prefix}' in ui_components:
1393
+ all_load_outputs.extend(ui_components[f'anima_controlnet_lllite_types_{prefix}'])
1394
+ all_load_outputs.extend(ui_components[f'anima_controlnet_lllite_series_{prefix}'])
1395
+ all_load_outputs.extend(ui_components[f'anima_controlnet_lllite_filepaths_{prefix}'])
1396
  if f'diffsynth_controlnet_types_{prefix}' in ui_components:
1397
  all_load_outputs.extend(ui_components[f'diffsynth_controlnet_types_{prefix}'])
1398
  all_load_outputs.extend(ui_components[f'diffsynth_controlnet_series_{prefix}'])
ui/shared/hires_fix_ui.py CHANGED
@@ -3,7 +3,7 @@ from core.settings import MODEL_MAP_CHECKPOINT
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
- create_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
@@ -74,6 +74,7 @@ def create_ui():
74
 
75
  components.update(create_lora_settings_ui(prefix))
76
  components.update(create_controlnet_ui(prefix))
 
77
  components.update(create_ipadapter_ui(prefix))
78
  components.update(create_flux1_ipadapter_ui(prefix))
79
  components.update(create_sd3_ipadapter_ui(prefix))
 
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
+ create_controlnet_ui, create_anima_controlnet_lllite_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
 
74
 
75
  components.update(create_lora_settings_ui(prefix))
76
  components.update(create_controlnet_ui(prefix))
77
+ components.update(create_anima_controlnet_lllite_ui(prefix))
78
  components.update(create_ipadapter_ui(prefix))
79
  components.update(create_flux1_ipadapter_ui(prefix))
80
  components.update(create_sd3_ipadapter_ui(prefix))
ui/shared/img2img_ui.py CHANGED
@@ -3,7 +3,7 @@ from core.settings import MODEL_MAP_CHECKPOINT
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
- create_controlnet_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
@@ -55,6 +55,7 @@ def create_ui():
55
 
56
  components.update(create_lora_settings_ui(prefix))
57
  components.update(create_controlnet_ui(prefix))
 
58
  components.update(create_diffsynth_controlnet_ui(prefix))
59
  components.update(create_ipadapter_ui(prefix))
60
  components.update(create_flux1_ipadapter_ui(prefix))
 
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
+ create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
 
55
 
56
  components.update(create_lora_settings_ui(prefix))
57
  components.update(create_controlnet_ui(prefix))
58
+ components.update(create_anima_controlnet_lllite_ui(prefix))
59
  components.update(create_diffsynth_controlnet_ui(prefix))
60
  components.update(create_ipadapter_ui(prefix))
61
  components.update(create_flux1_ipadapter_ui(prefix))
ui/shared/inpaint_ui.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from core.settings import MODEL_MAP_CHECKPOINT
3
  from .ui_components import (
4
  create_base_parameter_ui, create_lora_settings_ui,
5
- create_controlnet_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
6
  create_conditioning_ui, create_vae_override_ui,
7
  create_model_architecture_filter_ui, create_category_filter_ui,
8
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
@@ -87,6 +87,7 @@ def create_ui():
87
 
88
  components.update(create_lora_settings_ui(prefix))
89
  components.update(create_controlnet_ui(prefix))
 
90
  components.update(create_diffsynth_controlnet_ui(prefix))
91
  components.update(create_ipadapter_ui(prefix))
92
  components.update(create_flux1_ipadapter_ui(prefix))
 
2
  from core.settings import MODEL_MAP_CHECKPOINT
3
  from .ui_components import (
4
  create_base_parameter_ui, create_lora_settings_ui,
5
+ create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
6
  create_conditioning_ui, create_vae_override_ui,
7
  create_model_architecture_filter_ui, create_category_filter_ui,
8
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
 
87
 
88
  components.update(create_lora_settings_ui(prefix))
89
  components.update(create_controlnet_ui(prefix))
90
+ components.update(create_anima_controlnet_lllite_ui(prefix))
91
  components.update(create_diffsynth_controlnet_ui(prefix))
92
  components.update(create_ipadapter_ui(prefix))
93
  components.update(create_flux1_ipadapter_ui(prefix))
ui/shared/outpaint_ui.py CHANGED
@@ -3,7 +3,7 @@ from core.settings import MODEL_MAP_CHECKPOINT
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
- create_controlnet_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
@@ -70,6 +70,7 @@ def create_ui():
70
 
71
  components.update(create_lora_settings_ui(prefix))
72
  components.update(create_controlnet_ui(prefix))
 
73
  components.update(create_diffsynth_controlnet_ui(prefix))
74
  components.update(create_ipadapter_ui(prefix))
75
  components.update(create_flux1_ipadapter_ui(prefix))
 
3
  from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
4
  from .ui_components import (
5
  create_lora_settings_ui,
6
+ create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
7
  create_conditioning_ui, create_vae_override_ui,
8
  create_model_architecture_filter_ui, create_category_filter_ui,
9
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
 
70
 
71
  components.update(create_lora_settings_ui(prefix))
72
  components.update(create_controlnet_ui(prefix))
73
+ components.update(create_anima_controlnet_lllite_ui(prefix))
74
  components.update(create_diffsynth_controlnet_ui(prefix))
75
  components.update(create_ipadapter_ui(prefix))
76
  components.update(create_flux1_ipadapter_ui(prefix))
ui/shared/txt2img_ui.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from core.settings import MODEL_MAP_CHECKPOINT
3
  from .ui_components import (
4
  create_base_parameter_ui, create_lora_settings_ui,
5
- create_controlnet_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
6
  create_conditioning_ui, create_vae_override_ui,
7
  create_model_architecture_filter_ui, create_category_filter_ui,
8
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
@@ -42,6 +42,7 @@ def create_ui():
42
 
43
  components.update(create_lora_settings_ui(prefix))
44
  components.update(create_controlnet_ui(prefix))
 
45
  components.update(create_diffsynth_controlnet_ui(prefix))
46
  components.update(create_ipadapter_ui(prefix))
47
  components.update(create_flux1_ipadapter_ui(prefix))
 
2
  from core.settings import MODEL_MAP_CHECKPOINT
3
  from .ui_components import (
4
  create_base_parameter_ui, create_lora_settings_ui,
5
+ create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
6
  create_conditioning_ui, create_vae_override_ui,
7
  create_model_architecture_filter_ui, create_category_filter_ui,
8
  create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
 
42
 
43
  components.update(create_lora_settings_ui(prefix))
44
  components.update(create_controlnet_ui(prefix))
45
+ components.update(create_anima_controlnet_lllite_ui(prefix))
46
  components.update(create_diffsynth_controlnet_ui(prefix))
47
  components.update(create_ipadapter_ui(prefix))
48
  components.update(create_flux1_ipadapter_ui(prefix))
ui/shared/ui_components.py CHANGED
@@ -3,11 +3,13 @@ from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
3
  from core.settings import (
4
  MAX_LORAS, LORA_SOURCE_CHOICES, MAX_EMBEDDINGS, MAX_CONDITIONINGS,
5
  MAX_CONTROLNETS, MAX_IPADAPTERS, RESOLUTION_MAP, ARCHITECTURES_CONFIG,
6
- MODEL_MAP_CHECKPOINT, MODEL_TYPE_MAP, FEATURES_CONFIG, ARCH_CATEGORIES_MAP
 
7
  )
8
  import yaml
9
  import os
10
  from functools import lru_cache
 
11
 
12
  default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
13
  default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
@@ -186,6 +188,54 @@ def create_controlnet_ui(prefix: str, max_units=MAX_CONTROLNETS):
186
 
187
  return components
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  def create_diffsynth_controlnet_ui(prefix: str, max_units=MAX_CONTROLNETS):
190
  components = {}
191
  key = lambda name: f"{name}_{prefix}"
@@ -487,6 +537,13 @@ def create_conditioning_ui(prefix: str):
487
 
488
  return components
489
 
 
 
 
 
 
 
 
490
  def create_vae_override_ui(prefix: str):
491
  components = {}
492
  key = lambda name: f"{name}_{prefix}"
@@ -518,6 +575,12 @@ def create_vae_override_ui(prefix: str):
518
  components[key('vae_upload_button')] = upload_btn
519
  components[key('vae_file')] = gr.State(None)
520
 
 
 
 
 
 
 
521
  return components
522
 
523
  def create_reference_latent_ui(prefix: str, max_units=10):
 
3
  from core.settings import (
4
  MAX_LORAS, LORA_SOURCE_CHOICES, MAX_EMBEDDINGS, MAX_CONDITIONINGS,
5
  MAX_CONTROLNETS, MAX_IPADAPTERS, RESOLUTION_MAP, ARCHITECTURES_CONFIG,
6
+ MODEL_MAP_CHECKPOINT, MODEL_TYPE_MAP, FEATURES_CONFIG, ARCH_CATEGORIES_MAP,
7
+ VAE_DIR
8
  )
9
  import yaml
10
  import os
11
  from functools import lru_cache
12
+ from utils.app_utils import save_uploaded_file_with_hash
13
 
14
  default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
15
  default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
 
188
 
189
  return components
190
 
191
+ def create_anima_controlnet_lllite_ui(prefix: str, max_units=MAX_CONTROLNETS):
192
+ components = {}
193
+ key = lambda name: f"{name}_{prefix}"
194
+
195
+ with gr.Accordion("Anima ControlNet Lllite Settings", open=False, visible=('anima_controlnet_lllite' in default_enabled_chains)) as accordion:
196
+ components[key('anima_controlnet_lllite_accordion')] = accordion
197
+ gr.Markdown("💡 **Tip:** Processed using the [kohya-ss/ComfyUI-Anima-LLLite](https://github.com/kohya-ss/ComfyUI-Anima-LLLite) node. You can use [ControlNet-Preprocessors](https://huggingface.co/spaces/RioShiina/ControlNet-Preprocessors) to generate preprocessed images.")
198
+
199
+ cn_rows, images, series, types, strengths, filepaths, start_percents, end_percents = [], [], [], [], [], [], [], []
200
+ components.update({
201
+ key('anima_controlnet_lllite_rows'): cn_rows,
202
+ key('anima_controlnet_lllite_images'): images,
203
+ key('anima_controlnet_lllite_series'): series,
204
+ key('anima_controlnet_lllite_types'): types,
205
+ key('anima_controlnet_lllite_strengths'): strengths,
206
+ key('anima_controlnet_lllite_filepaths'): filepaths,
207
+ key('anima_controlnet_lllite_start_percents'): start_percents,
208
+ key('anima_controlnet_lllite_end_percents'): end_percents
209
+ })
210
+
211
+ for i in range(max_units):
212
+ with gr.Row(visible=(i < 1)) as row:
213
+ with gr.Column(scale=1):
214
+ images.append(gr.Image(label=f"Control Image {i+1}", type="pil", sources=["upload"], height=256))
215
+ with gr.Column(scale=2):
216
+ types.append(gr.Dropdown(label="Type", choices=[], interactive=True, allow_custom_value=True))
217
+ series.append(gr.Dropdown(label="Series", choices=[], interactive=True, allow_custom_value=True))
218
+ strengths.append(gr.Slider(label="Strength", minimum=0.0, maximum=2.0, step=0.05, value=1.0, interactive=True))
219
+ with gr.Row(visible=False):
220
+ start_percents.append(gr.State(0.0))
221
+ end_percents.append(gr.State(1.0))
222
+ filepaths.append(gr.State(None))
223
+ cn_rows.append(row)
224
+
225
+ with gr.Row():
226
+ components[key('add_anima_controlnet_lllite_button')] = gr.Button("✚ Add Lllite")
227
+ components[key('delete_anima_controlnet_lllite_button')] = gr.Button("➖ Delete Lllite", visible=False)
228
+ components[key('anima_controlnet_lllite_count_state')] = gr.State(1)
229
+
230
+ all_cn_components_flat = []
231
+ for i in range(max_units):
232
+ all_cn_components_flat.extend([
233
+ images[i], types[i], series[i], strengths[i], filepaths[i], start_percents[i], end_percents[i]
234
+ ])
235
+ components[key('all_anima_controlnet_lllite_components_flat')] = all_cn_components_flat
236
+
237
+ return components
238
+
239
  def create_diffsynth_controlnet_ui(prefix: str, max_units=MAX_CONTROLNETS):
240
  components = {}
241
  key = lambda name: f"{name}_{prefix}"
 
537
 
538
  return components
539
 
540
+ def on_vae_upload(file_obj):
541
+ if not file_obj:
542
+ return gr.update(), gr.update(), None
543
+
544
+ hashed_filename = save_uploaded_file_with_hash(file_obj, VAE_DIR)
545
+ return hashed_filename, "File", file_obj
546
+
547
  def create_vae_override_ui(prefix: str):
548
  components = {}
549
  key = lambda name: f"{name}_{prefix}"
 
575
  components[key('vae_upload_button')] = upload_btn
576
  components[key('vae_file')] = gr.State(None)
577
 
578
+ upload_btn.upload(
579
+ fn=on_vae_upload,
580
+ inputs=[upload_btn],
581
+ outputs=[components[key('vae_id')], components[key('vae_source')], components[key('vae_file')]]
582
+ )
583
+
584
  return components
585
 
586
  def create_reference_latent_ui(prefix: str, max_units=10):
yaml/anima_controlnet_lllite_models.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Anima_ControlNet_Lllite:
2
+ - Filepath: "anima-lllite-lineart-1.safetensors"
3
+ Series: "kohya-ss"
4
+ Type: ["Lineart"]
5
+ - Filepath: "anima-lllite-depth-1.safetensors"
6
+ Series: "kohya-ss"
7
+ Type: ["Depth"]
8
+ - Filepath: "anima-lllite-pose-1.safetensors"
9
+ Series: "kohya-ss"
10
+ Type: ["Pose"]
11
+ - Filepath: "anima-lllite-scribble-1.safetensors"
12
+ Series: "kohya-ss"
13
+ Type: ["Scribble"]
yaml/file_list.yaml CHANGED
@@ -137,6 +137,23 @@ file:
137
  repo_id: "Comfy-Org/sigclip_vision_384"
138
  repository_file_path: "sigclip_vision_patch14_384.safetensors"
139
  controlnet:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  # SD3.5
141
  - filename: "sd3.5_large_controlnet_blur.safetensors"
142
  source: "hf"
 
137
  repo_id: "Comfy-Org/sigclip_vision_384"
138
  repository_file_path: "sigclip_vision_patch14_384.safetensors"
139
  controlnet:
140
+ # Anima
141
+ - filename: "anima-lllite-lineart-1.safetensors"
142
+ source: "hf"
143
+ repo_id: "kohya-ss/Anima-LLLite"
144
+ repository_file_path: "anima-lllite-lineart-1.safetensors"
145
+ - filename: "anima-lllite-depth-1.safetensors"
146
+ source: "hf"
147
+ repo_id: "kohya-ss/Anima-LLLite"
148
+ repository_file_path: "anima-lllite-depth-1.safetensors"
149
+ - filename: "anima-lllite-pose-1.safetensors"
150
+ source: "hf"
151
+ repo_id: "kohya-ss/Anima-LLLite"
152
+ repository_file_path: "anima-lllite-pose-1.safetensors"
153
+ - filename: "anima-lllite-scribble-1.safetensors"
154
+ source: "hf"
155
+ repo_id: "kohya-ss/Anima-LLLite"
156
+ repository_file_path: "anima-lllite-scribble-1.safetensors"
157
  # SD3.5
158
  - filename: "sd3.5_large_controlnet_blur.safetensors"
159
  source: "hf"
yaml/image_gen_features.yaml CHANGED
@@ -44,6 +44,7 @@ longcat-image:
44
  anima:
45
  enabled_chains:
46
  - lora
 
47
  - conditioning
48
 
49
  newbie-image:
 
44
  anima:
45
  enabled_chains:
46
  - lora
47
+ - anima_controlnet_lllite
48
  - conditioning
49
 
50
  newbie-image:
yaml/injectors.yaml CHANGED
@@ -7,6 +7,8 @@ injector_definitions:
7
  module: "chain_injectors.newbie_lora_injector"
8
  dynamic_controlnet_chains:
9
  module: "chain_injectors.controlnet_injector"
 
 
10
  dynamic_diffsynth_controlnet_chains:
11
  module: "chain_injectors.diffsynth_controlnet_injector"
12
  dynamic_ipadapter_chains:
@@ -33,4 +35,5 @@ injector_order:
33
  - dynamic_style_chains
34
  - dynamic_conditioning_chains
35
  - dynamic_reference_latent_chains
36
- - dynamic_controlnet_chains
 
 
7
  module: "chain_injectors.newbie_lora_injector"
8
  dynamic_controlnet_chains:
9
  module: "chain_injectors.controlnet_injector"
10
+ dynamic_anima_controlnet_lllite_chains:
11
+ module: "chain_injectors.anima_controlnet_lllite_injector"
12
  dynamic_diffsynth_controlnet_chains:
13
  module: "chain_injectors.diffsynth_controlnet_injector"
14
  dynamic_ipadapter_chains:
 
35
  - dynamic_style_chains
36
  - dynamic_conditioning_chains
37
  - dynamic_reference_latent_chains
38
+ - dynamic_controlnet_chains
39
+ - dynamic_anima_controlnet_lllite_chains