feat: add MOSS-Image Color/Depth Control and update upstream requirements
Browse files- README.md +1 -0
- chain_injectors/moss_image_control_injector.py +162 -0
- core/pipelines/pipeline_input_processor.py +49 -0
- core/pipelines/sd_image_pipeline.py +2 -0
- core/pipelines/workflow_recipes/_partials/conditioning/moss-image.yaml +6 -0
- mcp_tools/common.py +50 -0
- requirements.txt +4 -4
- ui/events/change_handlers.py +4 -2
- ui/events/main.py +9 -2
- ui/events/run_handlers.py +9 -0
- ui/imagegen_ui.py +2 -1
- ui/shared/ui_components.py +35 -0
- yaml/chain_features.yaml +34 -0
- yaml/file_list.yaml +5 -0
- yaml/model_architecture_features.yaml +1 -0
- yaml/task_features.yaml +5 -0
README.md
CHANGED
|
@@ -164,6 +164,7 @@ models:
|
|
| 164 |
- Boogu/Boogu-Image-0.1-Edit-Turbo
|
| 165 |
- briaai/Fibo-2.0-dev
|
| 166 |
- briaai/Fibo-2.0-edit-turbo
|
|
|
|
| 167 |
- HiDream-ai/HiDream-I1-Dev
|
| 168 |
- HiDream-ai/HiDream-I1-Fast
|
| 169 |
- HiDream-ai/HiDream-I1-Full
|
|
|
|
| 164 |
- Boogu/Boogu-Image-0.1-Edit-Turbo
|
| 165 |
- briaai/Fibo-2.0-dev
|
| 166 |
- briaai/Fibo-2.0-edit-turbo
|
| 167 |
+
- darask0/MOSS-Image-color-depth-control
|
| 168 |
- HiDream-ai/HiDream-I1-Dev
|
| 169 |
- HiDream-ai/HiDream-I1-Fast
|
| 170 |
- HiDream-ai/HiDream-I1-Full
|
chain_injectors/moss_image_control_injector.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
try:
|
| 4 |
+
from utils.app_utils import ensure_file_downloaded
|
| 5 |
+
except ImportError:
|
| 6 |
+
ensure_file_downloaded = None
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def create_node(assembler, class_type, title=None):
|
| 10 |
+
try:
|
| 11 |
+
node = assembler._get_node_template_from_api(class_type)
|
| 12 |
+
except Exception:
|
| 13 |
+
try:
|
| 14 |
+
node = assembler._get_node_template(class_type)
|
| 15 |
+
except Exception:
|
| 16 |
+
node = {
|
| 17 |
+
"inputs": {},
|
| 18 |
+
"class_type": class_type,
|
| 19 |
+
"_meta": {"title": title or class_type}
|
| 20 |
+
}
|
| 21 |
+
if title:
|
| 22 |
+
node.setdefault('_meta', {})['title'] = title
|
| 23 |
+
return node
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def inject(assembler, chain_definition, chain_items):
|
| 27 |
+
"""
|
| 28 |
+
Injects MOSS-Image Color/Depth Control into the workflow:
|
| 29 |
+
1. Loads the darask0/MOSS-Image-color-depth-control LoRA adapter (moss-control.safetensors)
|
| 30 |
+
which widens the video_embedder from 128 to 384 channels.
|
| 31 |
+
2. Loads and scales the color map and/or depth map.
|
| 32 |
+
3. Adds the MOSSImageControl node to encode maps into latents, concatenate them into
|
| 33 |
+
concat_latent_image conditioning, and set timestep schedule (start/end percent).
|
| 34 |
+
4. Connects the patched model and conditioned positive/negative outputs to KSampler.
|
| 35 |
+
"""
|
| 36 |
+
if not chain_items:
|
| 37 |
+
return
|
| 38 |
+
|
| 39 |
+
# Normalize chain_items: may be a single dict or list of dicts
|
| 40 |
+
if isinstance(chain_items, dict):
|
| 41 |
+
item_data = chain_items
|
| 42 |
+
elif isinstance(chain_items, list) and len(chain_items) > 0:
|
| 43 |
+
item_data = chain_items[0]
|
| 44 |
+
if not isinstance(item_data, dict):
|
| 45 |
+
return
|
| 46 |
+
else:
|
| 47 |
+
return
|
| 48 |
+
|
| 49 |
+
color_map = item_data.get('color_map')
|
| 50 |
+
depth_map = item_data.get('depth_map')
|
| 51 |
+
|
| 52 |
+
if not color_map and not depth_map:
|
| 53 |
+
return
|
| 54 |
+
|
| 55 |
+
lora_filename = "moss-control.safetensors"
|
| 56 |
+
if ensure_file_downloaded:
|
| 57 |
+
try:
|
| 58 |
+
ensure_file_downloaded(lora_filename)
|
| 59 |
+
except Exception as e:
|
| 60 |
+
print(f"Warning: Failed to ensure '{lora_filename}' downloaded: {e}")
|
| 61 |
+
|
| 62 |
+
ksampler_name = chain_definition.get('ksampler_node', 'ksampler')
|
| 63 |
+
vae_loader_name = chain_definition.get('vae_loader_node', 'vae_loader')
|
| 64 |
+
|
| 65 |
+
if ksampler_name not in assembler.node_map:
|
| 66 |
+
print(f"Warning: Target node '{ksampler_name}' for MOSS-Image Control chain not found. Skipping.")
|
| 67 |
+
return
|
| 68 |
+
|
| 69 |
+
ksampler_id = assembler.node_map[ksampler_name]
|
| 70 |
+
|
| 71 |
+
if 'model' not in assembler.workflow[ksampler_id]['inputs']:
|
| 72 |
+
print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping.")
|
| 73 |
+
return
|
| 74 |
+
|
| 75 |
+
if 'positive' not in assembler.workflow[ksampler_id]['inputs'] or \
|
| 76 |
+
'negative' not in assembler.workflow[ksampler_id]['inputs']:
|
| 77 |
+
print(f"Warning: KSampler node '{ksampler_name}' is missing 'positive' or 'negative' inputs. Skipping.")
|
| 78 |
+
return
|
| 79 |
+
|
| 80 |
+
current_model_connection = assembler.workflow[ksampler_id]['inputs']['model']
|
| 81 |
+
current_pos_connection = assembler.workflow[ksampler_id]['inputs']['positive']
|
| 82 |
+
current_neg_connection = assembler.workflow[ksampler_id]['inputs']['negative']
|
| 83 |
+
|
| 84 |
+
vae_connection = None
|
| 85 |
+
if vae_loader_name in assembler.node_map:
|
| 86 |
+
vae_connection = [assembler.node_map[vae_loader_name], 0]
|
| 87 |
+
else:
|
| 88 |
+
for node_id, node in assembler.workflow.items():
|
| 89 |
+
if isinstance(node, dict) and node.get('class_type') == 'VAELoader':
|
| 90 |
+
vae_connection = [node_id, 0]
|
| 91 |
+
break
|
| 92 |
+
|
| 93 |
+
if not vae_connection:
|
| 94 |
+
print("Warning: VAE connection not found for MOSS-Image Control. Skipping.")
|
| 95 |
+
return
|
| 96 |
+
|
| 97 |
+
megapixels = float(chain_definition.get('megapixels', 1.0))
|
| 98 |
+
|
| 99 |
+
# 1. Inject LoRA loader onto the model path
|
| 100 |
+
lora_loader_id = assembler._get_unique_id()
|
| 101 |
+
lora_loader_node = create_node(assembler, "LoraLoaderModelOnly", "Load LoRA (MOSS-Image Control)")
|
| 102 |
+
lora_loader_node['inputs']['lora_name'] = lora_filename
|
| 103 |
+
lora_loader_node['inputs']['strength_model'] = 1.0
|
| 104 |
+
lora_loader_node['inputs']['model'] = current_model_connection
|
| 105 |
+
assembler.workflow[lora_loader_id] = lora_loader_node
|
| 106 |
+
current_model_connection = [lora_loader_id, 0]
|
| 107 |
+
|
| 108 |
+
# 2. Process Color Map if provided
|
| 109 |
+
scale_color_id = None
|
| 110 |
+
if color_map:
|
| 111 |
+
load_color_id = assembler._get_unique_id()
|
| 112 |
+
load_color_node = create_node(assembler, "LoadImage", "Load MOSS Color Map")
|
| 113 |
+
load_color_node['inputs']['image'] = color_map
|
| 114 |
+
assembler.workflow[load_color_id] = load_color_node
|
| 115 |
+
|
| 116 |
+
scale_color_id = assembler._get_unique_id()
|
| 117 |
+
scale_color_node = create_node(assembler, "ImageScaleToTotalPixels", "Scale MOSS Color Map")
|
| 118 |
+
scale_color_node['inputs']['upscale_method'] = "nearest-exact"
|
| 119 |
+
scale_color_node['inputs']['megapixels'] = megapixels
|
| 120 |
+
scale_color_node['inputs']['resolution_steps'] = 1
|
| 121 |
+
scale_color_node['inputs']['image'] = [load_color_id, 0]
|
| 122 |
+
assembler.workflow[scale_color_id] = scale_color_node
|
| 123 |
+
|
| 124 |
+
# 3. Process Depth Map if provided
|
| 125 |
+
scale_depth_id = None
|
| 126 |
+
if depth_map:
|
| 127 |
+
load_depth_id = assembler._get_unique_id()
|
| 128 |
+
load_depth_node = create_node(assembler, "LoadImage", "Load MOSS Depth Map")
|
| 129 |
+
load_depth_node['inputs']['image'] = depth_map
|
| 130 |
+
assembler.workflow[load_depth_id] = load_depth_node
|
| 131 |
+
|
| 132 |
+
scale_depth_id = assembler._get_unique_id()
|
| 133 |
+
scale_depth_node = create_node(assembler, "ImageScaleToTotalPixels", "Scale MOSS Depth Map")
|
| 134 |
+
scale_depth_node['inputs']['upscale_method'] = "nearest-exact"
|
| 135 |
+
scale_depth_node['inputs']['megapixels'] = megapixels
|
| 136 |
+
scale_depth_node['inputs']['resolution_steps'] = 1
|
| 137 |
+
scale_depth_node['inputs']['image'] = [load_depth_id, 0]
|
| 138 |
+
assembler.workflow[scale_depth_id] = scale_depth_node
|
| 139 |
+
|
| 140 |
+
# 4. Create MOSSImageControl node
|
| 141 |
+
moss_control_id = assembler._get_unique_id()
|
| 142 |
+
moss_control_node = create_node(assembler, "MOSSImageControl", "MOSS-Image Color/Depth Control")
|
| 143 |
+
moss_control_node['inputs']['positive'] = current_pos_connection
|
| 144 |
+
moss_control_node['inputs']['negative'] = current_neg_connection
|
| 145 |
+
moss_control_node['inputs']['vae'] = vae_connection
|
| 146 |
+
moss_control_node['inputs']['strength'] = float(item_data.get('strength', 1.0))
|
| 147 |
+
moss_control_node['inputs']['start_percent'] = float(item_data.get('start_percent', 0.0))
|
| 148 |
+
moss_control_node['inputs']['end_percent'] = float(item_data.get('end_percent', 0.5))
|
| 149 |
+
|
| 150 |
+
if scale_color_id:
|
| 151 |
+
moss_control_node['inputs']['color_map'] = [scale_color_id, 0]
|
| 152 |
+
if scale_depth_id:
|
| 153 |
+
moss_control_node['inputs']['depth_map'] = [scale_depth_id, 0]
|
| 154 |
+
|
| 155 |
+
assembler.workflow[moss_control_id] = moss_control_node
|
| 156 |
+
|
| 157 |
+
# 5. Connect back to KSampler
|
| 158 |
+
assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connection
|
| 159 |
+
assembler.workflow[ksampler_id]['inputs']['positive'] = [moss_control_id, 0]
|
| 160 |
+
assembler.workflow[ksampler_id]['inputs']['negative'] = [moss_control_id, 1]
|
| 161 |
+
|
| 162 |
+
print(f"MOSS-Image Color/Depth Control injector applied (color_map: {bool(color_map)}, depth_map: {bool(depth_map)}).")
|
core/pipelines/pipeline_input_processor.py
CHANGED
|
@@ -444,6 +444,54 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
|
|
| 444 |
item["system_prompt"] = str(sys_p)
|
| 445 |
active_flux3_prompt_upsampler.append(item)
|
| 446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
return {
|
| 448 |
"active_loras_for_gpu": active_loras_for_gpu,
|
| 449 |
"active_loras_for_meta": active_loras_for_meta,
|
|
@@ -464,5 +512,6 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
|
|
| 464 |
"active_qwen_image_2_1_prompt_enhancer": active_qwen_image_2_1_prompt_enhancer,
|
| 465 |
"active_ming_image_prompt_enhancer": active_ming_image_prompt_enhancer,
|
| 466 |
"active_flux3_prompt_upsampler": active_flux3_prompt_upsampler,
|
|
|
|
| 467 |
"temp_files_to_clean": temp_files_to_clean
|
| 468 |
}
|
|
|
|
| 444 |
item["system_prompt"] = str(sys_p)
|
| 445 |
active_flux3_prompt_upsampler.append(item)
|
| 446 |
|
| 447 |
+
color_map_val = ui_inputs.get('moss_image_control_color_map')
|
| 448 |
+
depth_map_val = ui_inputs.get('moss_image_control_depth_map')
|
| 449 |
+
active_moss_image_control = []
|
| 450 |
+
if 'moss_image_control' in enabled_chains and (color_map_val or depth_map_val):
|
| 451 |
+
color_filename = None
|
| 452 |
+
if color_map_val:
|
| 453 |
+
if isinstance(color_map_val, str):
|
| 454 |
+
color_filename = color_map_val
|
| 455 |
+
elif hasattr(color_map_val, 'save'):
|
| 456 |
+
if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
|
| 457 |
+
temp_path = os.path.join(INPUT_DIR, f"temp_moss_color_{random.randint(1000, 9999)}.png")
|
| 458 |
+
color_map_val.save(temp_path, "PNG")
|
| 459 |
+
temp_files_to_clean.append(temp_path)
|
| 460 |
+
color_filename = os.path.basename(temp_path)
|
| 461 |
+
|
| 462 |
+
depth_filename = None
|
| 463 |
+
if depth_map_val:
|
| 464 |
+
if isinstance(depth_map_val, str):
|
| 465 |
+
depth_filename = depth_map_val
|
| 466 |
+
elif hasattr(depth_map_val, 'save'):
|
| 467 |
+
if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
|
| 468 |
+
temp_path = os.path.join(INPUT_DIR, f"temp_moss_depth_{random.randint(1000, 9999)}.png")
|
| 469 |
+
depth_map_val.save(temp_path, "PNG")
|
| 470 |
+
temp_files_to_clean.append(temp_path)
|
| 471 |
+
depth_filename = os.path.basename(temp_path)
|
| 472 |
+
|
| 473 |
+
if color_filename or depth_filename:
|
| 474 |
+
try:
|
| 475 |
+
strength = float(ui_inputs.get('moss_image_control_strength', 1.0))
|
| 476 |
+
except (ValueError, TypeError):
|
| 477 |
+
strength = 1.0
|
| 478 |
+
try:
|
| 479 |
+
start_percent = float(ui_inputs.get('moss_image_control_start_percent', 0.0))
|
| 480 |
+
except (ValueError, TypeError):
|
| 481 |
+
start_percent = 0.0
|
| 482 |
+
try:
|
| 483 |
+
end_percent = float(ui_inputs.get('moss_image_control_end_percent', 0.5))
|
| 484 |
+
except (ValueError, TypeError):
|
| 485 |
+
end_percent = 0.5
|
| 486 |
+
|
| 487 |
+
active_moss_image_control.append({
|
| 488 |
+
'color_map': color_filename,
|
| 489 |
+
'depth_map': depth_filename,
|
| 490 |
+
'strength': strength,
|
| 491 |
+
'start_percent': start_percent,
|
| 492 |
+
'end_percent': end_percent
|
| 493 |
+
})
|
| 494 |
+
|
| 495 |
return {
|
| 496 |
"active_loras_for_gpu": active_loras_for_gpu,
|
| 497 |
"active_loras_for_meta": active_loras_for_meta,
|
|
|
|
| 512 |
"active_qwen_image_2_1_prompt_enhancer": active_qwen_image_2_1_prompt_enhancer,
|
| 513 |
"active_ming_image_prompt_enhancer": active_ming_image_prompt_enhancer,
|
| 514 |
"active_flux3_prompt_upsampler": active_flux3_prompt_upsampler,
|
| 515 |
+
"active_moss_image_control": active_moss_image_control,
|
| 516 |
"temp_files_to_clean": temp_files_to_clean
|
| 517 |
}
|
core/pipelines/sd_image_pipeline.py
CHANGED
|
@@ -122,6 +122,7 @@ class SdImagePipeline(BasePipeline):
|
|
| 122 |
active_qwen_image_2_1_prompt_enhancer = processed.get("active_qwen_image_2_1_prompt_enhancer", [])
|
| 123 |
active_ming_image_prompt_enhancer = processed.get("active_ming_image_prompt_enhancer", [])
|
| 124 |
active_flux3_prompt_upsampler = processed.get("active_flux3_prompt_upsampler", [])
|
|
|
|
| 125 |
|
| 126 |
loras_string = f"LoRAs: [{', '.join(active_loras_for_meta)}]" if active_loras_for_meta else ""
|
| 127 |
|
|
@@ -182,6 +183,7 @@ class SdImagePipeline(BasePipeline):
|
|
| 182 |
"qwen_image_2_1_prompt_enhancer_chain": active_qwen_image_2_1_prompt_enhancer,
|
| 183 |
"ming_image_prompt_enhancer_chain": active_ming_image_prompt_enhancer,
|
| 184 |
"flux3_prompt_upsampler_chain": active_flux3_prompt_upsampler,
|
|
|
|
| 185 |
"vae_chain": [ui_inputs.get('vae_name')] if (ui_inputs.get('vae_name') and 'vae' in enabled_chains) else [],
|
| 186 |
"hidream_o1_smoothing_chain": hidream_o1_smoothing_data,
|
| 187 |
"pid_chain": [ui_inputs.get('pid_settings', 'OFF')] if is_pid_enabled else [],
|
|
|
|
| 122 |
active_qwen_image_2_1_prompt_enhancer = processed.get("active_qwen_image_2_1_prompt_enhancer", [])
|
| 123 |
active_ming_image_prompt_enhancer = processed.get("active_ming_image_prompt_enhancer", [])
|
| 124 |
active_flux3_prompt_upsampler = processed.get("active_flux3_prompt_upsampler", [])
|
| 125 |
+
active_moss_image_control = processed.get("active_moss_image_control", [])
|
| 126 |
|
| 127 |
loras_string = f"LoRAs: [{', '.join(active_loras_for_meta)}]" if active_loras_for_meta else ""
|
| 128 |
|
|
|
|
| 183 |
"qwen_image_2_1_prompt_enhancer_chain": active_qwen_image_2_1_prompt_enhancer,
|
| 184 |
"ming_image_prompt_enhancer_chain": active_ming_image_prompt_enhancer,
|
| 185 |
"flux3_prompt_upsampler_chain": active_flux3_prompt_upsampler,
|
| 186 |
+
"moss_image_control_chain": active_moss_image_control,
|
| 187 |
"vae_chain": [ui_inputs.get('vae_name')] if (ui_inputs.get('vae_name') and 'vae' in enabled_chains) else [],
|
| 188 |
"hidream_o1_smoothing_chain": hidream_o1_smoothing_data,
|
| 189 |
"pid_chain": [ui_inputs.get('pid_settings', 'OFF')] if is_pid_enabled else [],
|
core/pipelines/workflow_recipes/_partials/conditioning/moss-image.yaml
CHANGED
|
@@ -70,6 +70,12 @@ dynamic_vae_chains:
|
|
| 70 |
- "vae_decode:vae"
|
| 71 |
- "vae_encode:vae"
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
dynamic_pid_chains:
|
| 74 |
pid_chain:
|
| 75 |
ksampler_node: "ksampler"
|
|
|
|
| 70 |
- "vae_decode:vae"
|
| 71 |
- "vae_encode:vae"
|
| 72 |
|
| 73 |
+
dynamic_moss_image_control_chains:
|
| 74 |
+
moss_image_control_chain:
|
| 75 |
+
ksampler_node: "ksampler"
|
| 76 |
+
vae_loader_node: "vae_loader"
|
| 77 |
+
megapixels: 1.0
|
| 78 |
+
|
| 79 |
dynamic_pid_chains:
|
| 80 |
pid_chain:
|
| 81 |
ksampler_node: "ksampler"
|
mcp_tools/common.py
CHANGED
|
@@ -644,6 +644,30 @@ def _execute_imagegen_pipeline(task_id: str, params: dict):
|
|
| 644 |
ui_inputs["flux3_prompt_upsampler_max_length"] = int(item.get("max_length", 3584))
|
| 645 |
if "system_prompt" in item:
|
| 646 |
ui_inputs["flux3_prompt_upsampler_system_prompt"] = str(item["system_prompt"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 647 |
elif itype == "krea2_identity_edit":
|
| 648 |
img = _parse_image_param(item.get("image"))
|
| 649 |
if img:
|
|
@@ -789,6 +813,32 @@ def _execute_imagegen_pipeline(task_id: str, params: dict):
|
|
| 789 |
else:
|
| 790 |
ui_inputs["flux3_prompt_upsampler_enable"] = False
|
| 791 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 792 |
_TASKS_DB[task_id]["progress"] = 50
|
| 793 |
|
| 794 |
# Execute Pipeline
|
|
|
|
| 644 |
ui_inputs["flux3_prompt_upsampler_max_length"] = int(item.get("max_length", 3584))
|
| 645 |
if "system_prompt" in item:
|
| 646 |
ui_inputs["flux3_prompt_upsampler_system_prompt"] = str(item["system_prompt"])
|
| 647 |
+
elif itype == "moss_image_control":
|
| 648 |
+
if "color_map" in item:
|
| 649 |
+
parsed_color_map = _parse_image_param(item["color_map"])
|
| 650 |
+
if parsed_color_map:
|
| 651 |
+
ui_inputs["moss_image_control_color_map"] = parsed_color_map
|
| 652 |
+
if "depth_map" in item:
|
| 653 |
+
parsed_depth_map = _parse_image_param(item["depth_map"])
|
| 654 |
+
if parsed_depth_map:
|
| 655 |
+
ui_inputs["moss_image_control_depth_map"] = parsed_depth_map
|
| 656 |
+
if "strength" in item:
|
| 657 |
+
try:
|
| 658 |
+
ui_inputs["moss_image_control_strength"] = float(item["strength"])
|
| 659 |
+
except (ValueError, TypeError):
|
| 660 |
+
pass
|
| 661 |
+
if "start_percent" in item:
|
| 662 |
+
try:
|
| 663 |
+
ui_inputs["moss_image_control_start_percent"] = float(item["start_percent"])
|
| 664 |
+
except (ValueError, TypeError):
|
| 665 |
+
pass
|
| 666 |
+
if "end_percent" in item:
|
| 667 |
+
try:
|
| 668 |
+
ui_inputs["moss_image_control_end_percent"] = float(item["end_percent"])
|
| 669 |
+
except (ValueError, TypeError):
|
| 670 |
+
pass
|
| 671 |
elif itype == "krea2_identity_edit":
|
| 672 |
img = _parse_image_param(item.get("image"))
|
| 673 |
if img:
|
|
|
|
| 813 |
else:
|
| 814 |
ui_inputs["flux3_prompt_upsampler_enable"] = False
|
| 815 |
|
| 816 |
+
moss_control_val = params.get("moss_image_control")
|
| 817 |
+
if moss_control_val and isinstance(moss_control_val, dict):
|
| 818 |
+
if "color_map" in moss_control_val:
|
| 819 |
+
parsed_color_map = _parse_image_param(moss_control_val["color_map"])
|
| 820 |
+
if parsed_color_map:
|
| 821 |
+
ui_inputs["moss_image_control_color_map"] = parsed_color_map
|
| 822 |
+
if "depth_map" in moss_control_val:
|
| 823 |
+
parsed_depth_map = _parse_image_param(moss_control_val["depth_map"])
|
| 824 |
+
if parsed_depth_map:
|
| 825 |
+
ui_inputs["moss_image_control_depth_map"] = parsed_depth_map
|
| 826 |
+
if "strength" in moss_control_val:
|
| 827 |
+
try:
|
| 828 |
+
ui_inputs["moss_image_control_strength"] = float(moss_control_val["strength"])
|
| 829 |
+
except (ValueError, TypeError):
|
| 830 |
+
pass
|
| 831 |
+
if "start_percent" in moss_control_val:
|
| 832 |
+
try:
|
| 833 |
+
ui_inputs["moss_image_control_start_percent"] = float(moss_control_val["start_percent"])
|
| 834 |
+
except (ValueError, TypeError):
|
| 835 |
+
pass
|
| 836 |
+
if "end_percent" in moss_control_val:
|
| 837 |
+
try:
|
| 838 |
+
ui_inputs["moss_image_control_end_percent"] = float(moss_control_val["end_percent"])
|
| 839 |
+
except (ValueError, TypeError):
|
| 840 |
+
pass
|
| 841 |
+
|
| 842 |
_TASKS_DB[task_id]["progress"] = 50
|
| 843 |
|
| 844 |
# Execute Pipeline
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
comfyui-frontend-package==1.57.1
|
| 2 |
-
comfyui-workflow-templates==0.11.
|
| 3 |
comfyui-embedded-docs==0.5.14
|
| 4 |
torch
|
| 5 |
torchsde
|
|
@@ -13,7 +13,7 @@ safetensors>=0.4.2
|
|
| 13 |
aiohttp>=3.11.8
|
| 14 |
yarl>=1.18.0
|
| 15 |
pyyaml
|
| 16 |
-
Pillow
|
| 17 |
scipy
|
| 18 |
tqdm
|
| 19 |
psutil
|
|
@@ -21,8 +21,8 @@ alembic
|
|
| 21 |
SQLAlchemy>=2.0.0
|
| 22 |
filelock
|
| 23 |
av>=17.0.0
|
| 24 |
-
comfy-
|
| 25 |
-
comfy-
|
| 26 |
requests
|
| 27 |
simpleeval>=1.0.0
|
| 28 |
blake3
|
|
|
|
| 1 |
comfyui-frontend-package==1.57.1
|
| 2 |
+
comfyui-workflow-templates==0.11.96
|
| 3 |
comfyui-embedded-docs==0.5.14
|
| 4 |
torch
|
| 5 |
torchsde
|
|
|
|
| 13 |
aiohttp>=3.11.8
|
| 14 |
yarl>=1.18.0
|
| 15 |
pyyaml
|
| 16 |
+
Pillow>=10.1.0
|
| 17 |
scipy
|
| 18 |
tqdm
|
| 19 |
psutil
|
|
|
|
| 21 |
SQLAlchemy>=2.0.0
|
| 22 |
filelock
|
| 23 |
av>=17.0.0
|
| 24 |
+
comfy-aimdo==0.6.0
|
| 25 |
+
comfy-kitchen==0.2.40
|
| 26 |
requests
|
| 27 |
simpleeval>=1.0.0
|
| 28 |
blake3
|
ui/events/change_handlers.py
CHANGED
|
@@ -15,7 +15,7 @@ from .config_loaders import (
|
|
| 15 |
load_ipadapter_config
|
| 16 |
)
|
| 17 |
|
| 18 |
-
def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, ipa_preset, lora_acc, cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None, qwen_pe_acc=None, ming_pe_acc=None, flux3_pe_acc=None):
|
| 19 |
def update_fn(*args):
|
| 20 |
arch = args[0]
|
| 21 |
category = args[1]
|
|
@@ -87,6 +87,7 @@ def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types,
|
|
| 87 |
if qwen_pe_acc: updates[qwen_pe_acc] = gr.update(visible=('qwen_image_2_1_prompt_enhancer' in enabled_chains))
|
| 88 |
if ming_pe_acc: updates[ming_pe_acc] = gr.update(visible=('ming_image_prompt_enhancer' in enabled_chains))
|
| 89 |
if flux3_pe_acc: updates[flux3_pe_acc] = gr.update(visible=('flux3_prompt_upsampler' in enabled_chains))
|
|
|
|
| 90 |
|
| 91 |
if ar_comp:
|
| 92 |
res_key = arch_model_type
|
|
@@ -131,7 +132,7 @@ def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types,
|
|
| 131 |
return update_fn
|
| 132 |
|
| 133 |
|
| 134 |
-
def make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None, qwen_pe_acc=None, ming_pe_acc=None, flux3_pe_acc=None):
|
| 135 |
def change_fn(*args):
|
| 136 |
model_name = args[0]
|
| 137 |
idx = 1
|
|
@@ -211,6 +212,7 @@ def make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_type
|
|
| 211 |
if qwen_pe_acc: updates[qwen_pe_acc] = gr.update(visible=('qwen_image_2_1_prompt_enhancer' in enabled_chains))
|
| 212 |
if ming_pe_acc: updates[ming_pe_acc] = gr.update(visible=('ming_image_prompt_enhancer' in enabled_chains))
|
| 213 |
if flux3_pe_acc: updates[flux3_pe_acc] = gr.update(visible=('flux3_prompt_upsampler' in enabled_chains))
|
|
|
|
| 214 |
|
| 215 |
if ar_comp:
|
| 216 |
res_key = arch_model_type
|
|
|
|
| 15 |
load_ipadapter_config
|
| 16 |
)
|
| 17 |
|
| 18 |
+
def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, ipa_preset, lora_acc, cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None, qwen_pe_acc=None, ming_pe_acc=None, flux3_pe_acc=None, moss_image_control_acc=None):
|
| 19 |
def update_fn(*args):
|
| 20 |
arch = args[0]
|
| 21 |
category = args[1]
|
|
|
|
| 87 |
if qwen_pe_acc: updates[qwen_pe_acc] = gr.update(visible=('qwen_image_2_1_prompt_enhancer' in enabled_chains))
|
| 88 |
if ming_pe_acc: updates[ming_pe_acc] = gr.update(visible=('ming_image_prompt_enhancer' in enabled_chains))
|
| 89 |
if flux3_pe_acc: updates[flux3_pe_acc] = gr.update(visible=('flux3_prompt_upsampler' in enabled_chains))
|
| 90 |
+
if moss_image_control_acc: updates[moss_image_control_acc] = gr.update(visible=('moss_image_control' in enabled_chains))
|
| 91 |
|
| 92 |
if ar_comp:
|
| 93 |
res_key = arch_model_type
|
|
|
|
| 132 |
return update_fn
|
| 133 |
|
| 134 |
|
| 135 |
+
def make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None, qwen_pe_acc=None, ming_pe_acc=None, flux3_pe_acc=None, moss_image_control_acc=None):
|
| 136 |
def change_fn(*args):
|
| 137 |
model_name = args[0]
|
| 138 |
idx = 1
|
|
|
|
| 212 |
if qwen_pe_acc: updates[qwen_pe_acc] = gr.update(visible=('qwen_image_2_1_prompt_enhancer' in enabled_chains))
|
| 213 |
if ming_pe_acc: updates[ming_pe_acc] = gr.update(visible=('ming_image_prompt_enhancer' in enabled_chains))
|
| 214 |
if flux3_pe_acc: updates[flux3_pe_acc] = gr.update(visible=('flux3_prompt_upsampler' in enabled_chains))
|
| 215 |
+
if moss_image_control_acc: updates[moss_image_control_acc] = gr.update(visible=('moss_image_control' in enabled_chains))
|
| 216 |
|
| 217 |
if ar_comp:
|
| 218 |
res_key = arch_model_type
|
ui/events/main.py
CHANGED
|
@@ -65,6 +65,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 65 |
qwen_pe_accordion = ui_components.get(f'qwen_image_2_1_prompt_enhancer_accordion_{prefix}')
|
| 66 |
ming_pe_accordion = ui_components.get(f'ming_image_prompt_enhancer_accordion_{prefix}')
|
| 67 |
flux3_pe_accordion = ui_components.get(f'flux3_prompt_upsampler_accordion_{prefix}')
|
|
|
|
| 68 |
|
| 69 |
ipa_preset_list = ui_components.get(f'ipadapter_final_preset_{prefix}')
|
| 70 |
|
|
@@ -103,6 +104,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 103 |
if qwen_pe_accordion: outputs.append(qwen_pe_accordion)
|
| 104 |
if ming_pe_accordion: outputs.append(ming_pe_accordion)
|
| 105 |
if flux3_pe_accordion: outputs.append(flux3_pe_accordion)
|
|
|
|
| 106 |
if ipa_preset_list: outputs.append(ipa_preset_list)
|
| 107 |
|
| 108 |
outputs.extend(valid_extra_comps)
|
|
@@ -113,7 +115,8 @@ def attach_event_handlers(ui_components, demo):
|
|
| 113 |
ipa_preset_list, lora_accordion, cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
|
| 114 |
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
|
| 115 |
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
|
| 116 |
-
task_type=task_type, type_comp=type_comp, qwen_pe_acc=qwen_pe_accordion, ming_pe_acc=ming_pe_accordion, flux3_pe_acc=flux3_pe_accordion
|
|
|
|
| 117 |
)
|
| 118 |
inputs = [arch_comp, cat_comp]
|
| 119 |
if aspect_ratio_comp:
|
|
@@ -150,6 +153,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 150 |
if qwen_pe_accordion: outputs2.append(qwen_pe_accordion)
|
| 151 |
if ming_pe_accordion: outputs2.append(ming_pe_accordion)
|
| 152 |
if flux3_pe_accordion: outputs2.append(flux3_pe_accordion)
|
|
|
|
| 153 |
if ipa_preset_list: outputs2.append(ipa_preset_list)
|
| 154 |
|
| 155 |
outputs2.extend(valid_extra_comps)
|
|
@@ -165,7 +169,8 @@ def attach_event_handlers(ui_components, demo):
|
|
| 165 |
arch_comp, ipa_preset_list, lora_accordion, cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
|
| 166 |
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
|
| 167 |
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
|
| 168 |
-
task_type=task_type, type_comp=type_comp, qwen_pe_acc=qwen_pe_accordion, ming_pe_acc=ming_pe_accordion, flux3_pe_acc=flux3_pe_accordion
|
|
|
|
| 169 |
)
|
| 170 |
if type_comp:
|
| 171 |
inputs2.append(type_comp)
|
|
@@ -256,6 +261,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 256 |
f'qwen_image_2_1_prompt_enhancer_accordion_{prefix}': 'qwen_image_2_1_prompt_enhancer',
|
| 257 |
f'ming_image_prompt_enhancer_accordion_{prefix}': 'ming_image_prompt_enhancer',
|
| 258 |
f'flux3_prompt_upsampler_accordion_{prefix}': 'flux3_prompt_upsampler',
|
|
|
|
| 259 |
f'pid_accordion_{prefix}': 'pid',
|
| 260 |
f'vae_accordion_{prefix}': 'vae',
|
| 261 |
}
|
|
@@ -296,6 +302,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 296 |
'qwen_image_2_1_prompt_enhancer_accordion_imagegen',
|
| 297 |
'ming_image_prompt_enhancer_accordion_imagegen',
|
| 298 |
'flux3_prompt_upsampler_accordion_imagegen',
|
|
|
|
| 299 |
'pid_accordion_imagegen', 'vae_accordion_imagegen',
|
| 300 |
]
|
| 301 |
for key in accordion_keys:
|
|
|
|
| 65 |
qwen_pe_accordion = ui_components.get(f'qwen_image_2_1_prompt_enhancer_accordion_{prefix}')
|
| 66 |
ming_pe_accordion = ui_components.get(f'ming_image_prompt_enhancer_accordion_{prefix}')
|
| 67 |
flux3_pe_accordion = ui_components.get(f'flux3_prompt_upsampler_accordion_{prefix}')
|
| 68 |
+
moss_control_accordion = ui_components.get(f'moss_image_control_accordion_{prefix}')
|
| 69 |
|
| 70 |
ipa_preset_list = ui_components.get(f'ipadapter_final_preset_{prefix}')
|
| 71 |
|
|
|
|
| 104 |
if qwen_pe_accordion: outputs.append(qwen_pe_accordion)
|
| 105 |
if ming_pe_accordion: outputs.append(ming_pe_accordion)
|
| 106 |
if flux3_pe_accordion: outputs.append(flux3_pe_accordion)
|
| 107 |
+
if moss_control_accordion: outputs.append(moss_control_accordion)
|
| 108 |
if ipa_preset_list: outputs.append(ipa_preset_list)
|
| 109 |
|
| 110 |
outputs.extend(valid_extra_comps)
|
|
|
|
| 115 |
ipa_preset_list, lora_accordion, cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
|
| 116 |
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
|
| 117 |
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
|
| 118 |
+
task_type=task_type, type_comp=type_comp, qwen_pe_acc=qwen_pe_accordion, ming_pe_acc=ming_pe_accordion, flux3_pe_acc=flux3_pe_accordion,
|
| 119 |
+
moss_image_control_acc=moss_control_accordion
|
| 120 |
)
|
| 121 |
inputs = [arch_comp, cat_comp]
|
| 122 |
if aspect_ratio_comp:
|
|
|
|
| 153 |
if qwen_pe_accordion: outputs2.append(qwen_pe_accordion)
|
| 154 |
if ming_pe_accordion: outputs2.append(ming_pe_accordion)
|
| 155 |
if flux3_pe_accordion: outputs2.append(flux3_pe_accordion)
|
| 156 |
+
if moss_control_accordion: outputs2.append(moss_control_accordion)
|
| 157 |
if ipa_preset_list: outputs2.append(ipa_preset_list)
|
| 158 |
|
| 159 |
outputs2.extend(valid_extra_comps)
|
|
|
|
| 169 |
arch_comp, ipa_preset_list, lora_accordion, cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
|
| 170 |
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
|
| 171 |
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
|
| 172 |
+
task_type=task_type, type_comp=type_comp, qwen_pe_acc=qwen_pe_accordion, ming_pe_acc=ming_pe_accordion, flux3_pe_acc=flux3_pe_accordion,
|
| 173 |
+
moss_image_control_acc=moss_control_accordion
|
| 174 |
)
|
| 175 |
if type_comp:
|
| 176 |
inputs2.append(type_comp)
|
|
|
|
| 261 |
f'qwen_image_2_1_prompt_enhancer_accordion_{prefix}': 'qwen_image_2_1_prompt_enhancer',
|
| 262 |
f'ming_image_prompt_enhancer_accordion_{prefix}': 'ming_image_prompt_enhancer',
|
| 263 |
f'flux3_prompt_upsampler_accordion_{prefix}': 'flux3_prompt_upsampler',
|
| 264 |
+
f'moss_image_control_accordion_{prefix}': 'moss_image_control',
|
| 265 |
f'pid_accordion_{prefix}': 'pid',
|
| 266 |
f'vae_accordion_{prefix}': 'vae',
|
| 267 |
}
|
|
|
|
| 302 |
'qwen_image_2_1_prompt_enhancer_accordion_imagegen',
|
| 303 |
'ming_image_prompt_enhancer_accordion_imagegen',
|
| 304 |
'flux3_prompt_upsampler_accordion_imagegen',
|
| 305 |
+
'moss_image_control_accordion_imagegen',
|
| 306 |
'pid_accordion_imagegen', 'vae_accordion_imagegen',
|
| 307 |
]
|
| 308 |
for key in accordion_keys:
|
ui/events/run_handlers.py
CHANGED
|
@@ -62,6 +62,15 @@ def create_run_event(prefix: str, task_type: str = None, ui_components: dict = N
|
|
| 62 |
if ui_components.get(f'flux3_prompt_upsampler_max_length_{prefix}'):
|
| 63 |
run_inputs_map['flux3_prompt_upsampler_max_length'] = ui_components[f'flux3_prompt_upsampler_max_length_{prefix}']
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
# Generic / Txt2Img inputs
|
| 66 |
if ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width'):
|
| 67 |
run_inputs_map['width'] = ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width')
|
|
|
|
| 62 |
if ui_components.get(f'flux3_prompt_upsampler_max_length_{prefix}'):
|
| 63 |
run_inputs_map['flux3_prompt_upsampler_max_length'] = ui_components[f'flux3_prompt_upsampler_max_length_{prefix}']
|
| 64 |
|
| 65 |
+
if ui_components.get(f'moss_image_control_color_map_{prefix}'):
|
| 66 |
+
run_inputs_map['moss_image_control_color_map'] = ui_components[f'moss_image_control_color_map_{prefix}']
|
| 67 |
+
if ui_components.get(f'moss_image_control_depth_map_{prefix}'):
|
| 68 |
+
run_inputs_map['moss_image_control_depth_map'] = ui_components[f'moss_image_control_depth_map_{prefix}']
|
| 69 |
+
if ui_components.get(f'moss_image_control_strength_{prefix}'):
|
| 70 |
+
run_inputs_map['moss_image_control_strength'] = ui_components[f'moss_image_control_strength_{prefix}']
|
| 71 |
+
if ui_components.get(f'moss_image_control_end_percent_{prefix}'):
|
| 72 |
+
run_inputs_map['moss_image_control_end_percent'] = ui_components[f'moss_image_control_end_percent_{prefix}']
|
| 73 |
+
|
| 74 |
# Generic / Txt2Img inputs
|
| 75 |
if ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width'):
|
| 76 |
run_inputs_map['width'] = ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width')
|
ui/imagegen_ui.py
CHANGED
|
@@ -10,7 +10,7 @@ from .shared.ui_components import (
|
|
| 10 |
create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
|
| 11 |
create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui,
|
| 12 |
create_pid_ui, create_qwen_image_2_1_prompt_enhancer_ui, create_ming_image_prompt_enhancer_ui,
|
| 13 |
-
create_flux3_prompt_upsampler_ui
|
| 14 |
)
|
| 15 |
|
| 16 |
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
|
@@ -192,6 +192,7 @@ def create_ui():
|
|
| 192 |
components.update(create_ming_image_prompt_enhancer_ui(prefix))
|
| 193 |
components.update(create_flux3_prompt_upsampler_ui(prefix))
|
| 194 |
components.update(create_vae_override_ui(prefix))
|
|
|
|
| 195 |
components.update(create_pid_ui(prefix))
|
| 196 |
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 197 |
|
|
|
|
| 10 |
create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
|
| 11 |
create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui,
|
| 12 |
create_pid_ui, create_qwen_image_2_1_prompt_enhancer_ui, create_ming_image_prompt_enhancer_ui,
|
| 13 |
+
create_flux3_prompt_upsampler_ui, create_moss_image_control_ui
|
| 14 |
)
|
| 15 |
|
| 16 |
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
|
|
|
| 192 |
components.update(create_ming_image_prompt_enhancer_ui(prefix))
|
| 193 |
components.update(create_flux3_prompt_upsampler_ui(prefix))
|
| 194 |
components.update(create_vae_override_ui(prefix))
|
| 195 |
+
components.update(create_moss_image_control_ui(prefix))
|
| 196 |
components.update(create_pid_ui(prefix))
|
| 197 |
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 198 |
|
ui/shared/ui_components.py
CHANGED
|
@@ -647,6 +647,41 @@ def create_reference_image_ui(prefix: str, max_units=10):
|
|
| 647 |
components[key('all_reference_image_components_flat')] = ref_image_inputs
|
| 648 |
|
| 649 |
return components
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
|
| 651 |
def create_pid_ui(prefix: str):
|
| 652 |
components = {}
|
|
|
|
| 647 |
components[key('all_reference_image_components_flat')] = ref_image_inputs
|
| 648 |
|
| 649 |
return components
|
| 650 |
+
def create_moss_image_control_ui(prefix: str):
|
| 651 |
+
components = {}
|
| 652 |
+
key = lambda name: f"{name}_{prefix}"
|
| 653 |
+
|
| 654 |
+
with gr.Accordion("MOSS-Image Color/Depth Control Settings", open=False, visible=('moss_image_control' in default_enabled_chains)) as control_accordion:
|
| 655 |
+
components[key('moss_image_control_accordion')] = control_accordion
|
| 656 |
+
gr.Markdown("💡 **Tip:** Uses the [darask0/MOSS-Image-color-depth-control](https://huggingface.co/darask0/MOSS-Image-color-depth-control) adapter.")
|
| 657 |
+
with gr.Row():
|
| 658 |
+
components[key('moss_image_control_color_map')] = gr.Image(
|
| 659 |
+
type="pil", label="Color Region Map (Optional)", sources=["upload"], height=200
|
| 660 |
+
)
|
| 661 |
+
components[key('moss_image_control_depth_map')] = gr.Image(
|
| 662 |
+
type="pil", label="Depth Map (Optional, near=white)", sources=["upload"], height=200
|
| 663 |
+
)
|
| 664 |
+
|
| 665 |
+
with gr.Row():
|
| 666 |
+
components[key('moss_image_control_strength')] = gr.Slider(
|
| 667 |
+
label="Control Strength",
|
| 668 |
+
value=1.0,
|
| 669 |
+
minimum=0.0,
|
| 670 |
+
maximum=2.0,
|
| 671 |
+
step=0.05,
|
| 672 |
+
interactive=True
|
| 673 |
+
)
|
| 674 |
+
components[key('moss_image_control_end_percent')] = gr.Slider(
|
| 675 |
+
label="End Percent (0.5 for 3D mannequin)",
|
| 676 |
+
value=0.5,
|
| 677 |
+
minimum=0.0,
|
| 678 |
+
maximum=1.0,
|
| 679 |
+
step=0.01,
|
| 680 |
+
interactive=True
|
| 681 |
+
)
|
| 682 |
+
|
| 683 |
+
return components
|
| 684 |
+
|
| 685 |
|
| 686 |
def create_pid_ui(prefix: str):
|
| 687 |
components = {}
|
yaml/chain_features.yaml
CHANGED
|
@@ -523,3 +523,37 @@ flux3_prompt_upsampler:
|
|
| 523 |
system_prompt:
|
| 524 |
type: string
|
| 525 |
description: "Optional custom system prompt override (defaults to official t2i/i2i or t2i_bbox/i2i_bbox templates)."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 523 |
system_prompt:
|
| 524 |
type: string
|
| 525 |
description: "Optional custom system prompt override (defaults to official t2i/i2i or t2i_bbox/i2i_bbox templates)."
|
| 526 |
+
|
| 527 |
+
moss_image_control:
|
| 528 |
+
chains: moss_image_control
|
| 529 |
+
display_name: "MOSS-Image Color/Depth Control"
|
| 530 |
+
description: "Controls MOSS-Image generation using a color region map (object/region spatial layout) and/or a depth map (3D spatial depth, near is white) via darask0/MOSS-Image-color-depth-control adapter and MOSSImageControl node."
|
| 531 |
+
max_count: 1
|
| 532 |
+
usage_guideline: "Supply color_map (RGB region ID map) and/or depth_map (near=white grayscale map) as Base64 Data URI or HTTP/HTTPS URL. Set strength (default 1.0) and timestep range (start_percent 0.0, end_percent 0.5)."
|
| 533 |
+
parameters_schema:
|
| 534 |
+
type: object
|
| 535 |
+
properties:
|
| 536 |
+
color_map:
|
| 537 |
+
type: string
|
| 538 |
+
description: "Color region map image encoded as Base64 Data URI or HTTP/HTTPS URL. Each region uses a flat RGB color as a region ID."
|
| 539 |
+
depth_map:
|
| 540 |
+
type: string
|
| 541 |
+
description: "Depth map image encoded as Base64 Data URI or HTTP/HTTPS URL (near is white, far is dark)."
|
| 542 |
+
strength:
|
| 543 |
+
type: number
|
| 544 |
+
default: 1.0
|
| 545 |
+
minimum: 0.0
|
| 546 |
+
maximum: 2.0
|
| 547 |
+
description: "Control influence strength multiplier (default 1.0)."
|
| 548 |
+
start_percent:
|
| 549 |
+
type: number
|
| 550 |
+
default: 0.0
|
| 551 |
+
minimum: 0.0
|
| 552 |
+
maximum: 1.0
|
| 553 |
+
description: "Sampling percentage at which control begins (default 0.0)."
|
| 554 |
+
end_percent:
|
| 555 |
+
type: number
|
| 556 |
+
default: 0.5
|
| 557 |
+
minimum: 0.0
|
| 558 |
+
maximum: 1.0
|
| 559 |
+
description: "Sampling percentage at which control ends (default 0.5, use 0.5 for 3D mannequin)."
|
yaml/file_list.yaml
CHANGED
|
@@ -887,6 +887,11 @@ file:
|
|
| 887 |
repo_id: "black-forest-labs/FLUX.1-Redux-dev"
|
| 888 |
repository_file_path: "flux1-redux-dev.safetensors"
|
| 889 |
loras:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 890 |
# Krea2 Identity Edit
|
| 891 |
- filename: "krea2_identity_edit_v1_2.safetensors"
|
| 892 |
source: "hf"
|
|
|
|
| 887 |
repo_id: "black-forest-labs/FLUX.1-Redux-dev"
|
| 888 |
repository_file_path: "flux1-redux-dev.safetensors"
|
| 889 |
loras:
|
| 890 |
+
# MOSS-Image Color/Depth Control
|
| 891 |
+
- filename: "moss-control.safetensors"
|
| 892 |
+
source: "hf"
|
| 893 |
+
repo_id: "darask0/MOSS-Image-color-depth-control"
|
| 894 |
+
repository_file_path: "moss-control.safetensors"
|
| 895 |
# Krea2 Identity Edit
|
| 896 |
- filename: "krea2_identity_edit_v1_2.safetensors"
|
| 897 |
source: "hf"
|
yaml/model_architecture_features.yaml
CHANGED
|
@@ -86,6 +86,7 @@ z-image:
|
|
| 86 |
moss-image:
|
| 87 |
enabled_chains:
|
| 88 |
- lora
|
|
|
|
| 89 |
- pid
|
| 90 |
|
| 91 |
ming-image:
|
|
|
|
| 86 |
moss-image:
|
| 87 |
enabled_chains:
|
| 88 |
- lora
|
| 89 |
+
- moss_image_control
|
| 90 |
- pid
|
| 91 |
|
| 92 |
ming-image:
|
yaml/task_features.yaml
CHANGED
|
@@ -25,6 +25,7 @@ txt2img:
|
|
| 25 |
- qwen_image_2_1_prompt_enhancer
|
| 26 |
- ming_image_prompt_enhancer
|
| 27 |
- flux3_prompt_upsampler
|
|
|
|
| 28 |
- pid
|
| 29 |
- vae
|
| 30 |
|
|
@@ -50,6 +51,7 @@ img2img:
|
|
| 50 |
- qwen_image_2_1_prompt_enhancer
|
| 51 |
- ming_image_prompt_enhancer
|
| 52 |
- flux3_prompt_upsampler
|
|
|
|
| 53 |
- vae
|
| 54 |
|
| 55 |
inpaint:
|
|
@@ -74,6 +76,7 @@ inpaint:
|
|
| 74 |
- qwen_image_2_1_prompt_enhancer
|
| 75 |
- ming_image_prompt_enhancer
|
| 76 |
- flux3_prompt_upsampler
|
|
|
|
| 77 |
- vae
|
| 78 |
|
| 79 |
outpaint:
|
|
@@ -98,6 +101,7 @@ outpaint:
|
|
| 98 |
- qwen_image_2_1_prompt_enhancer
|
| 99 |
- ming_image_prompt_enhancer
|
| 100 |
- flux3_prompt_upsampler
|
|
|
|
| 101 |
- vae
|
| 102 |
|
| 103 |
hires_fix:
|
|
@@ -122,4 +126,5 @@ hires_fix:
|
|
| 122 |
- qwen_image_2_1_prompt_enhancer
|
| 123 |
- ming_image_prompt_enhancer
|
| 124 |
- flux3_prompt_upsampler
|
|
|
|
| 125 |
- vae
|
|
|
|
| 25 |
- qwen_image_2_1_prompt_enhancer
|
| 26 |
- ming_image_prompt_enhancer
|
| 27 |
- flux3_prompt_upsampler
|
| 28 |
+
- moss_image_control
|
| 29 |
- pid
|
| 30 |
- vae
|
| 31 |
|
|
|
|
| 51 |
- qwen_image_2_1_prompt_enhancer
|
| 52 |
- ming_image_prompt_enhancer
|
| 53 |
- flux3_prompt_upsampler
|
| 54 |
+
- moss_image_control
|
| 55 |
- vae
|
| 56 |
|
| 57 |
inpaint:
|
|
|
|
| 76 |
- qwen_image_2_1_prompt_enhancer
|
| 77 |
- ming_image_prompt_enhancer
|
| 78 |
- flux3_prompt_upsampler
|
| 79 |
+
- moss_image_control
|
| 80 |
- vae
|
| 81 |
|
| 82 |
outpaint:
|
|
|
|
| 101 |
- qwen_image_2_1_prompt_enhancer
|
| 102 |
- ming_image_prompt_enhancer
|
| 103 |
- flux3_prompt_upsampler
|
| 104 |
+
- moss_image_control
|
| 105 |
- vae
|
| 106 |
|
| 107 |
hires_fix:
|
|
|
|
| 126 |
- qwen_image_2_1_prompt_enhancer
|
| 127 |
- ming_image_prompt_enhancer
|
| 128 |
- flux3_prompt_upsampler
|
| 129 |
+
- moss_image_control
|
| 130 |
- vae
|