Upload folder using huggingface_hub
Browse files- README.md +2 -0
- chain_injectors/hidream_o1_reference_injector.py +54 -0
- chain_injectors/{hidream_smoothing_injector.py → hidream_o1_smoothing_injector.py} +1 -1
- core/pipelines/sd_image_pipeline.py +25 -5
- core/pipelines/workflow_recipes/_partials/conditioning/hidream-o1.yaml +6 -2
- requirements.txt +4 -4
- ui/events.py +83 -5
- ui/shared/hires_fix_ui.py +2 -1
- ui/shared/img2img_ui.py +2 -1
- ui/shared/inpaint_ui.py +2 -1
- ui/shared/outpaint_ui.py +2 -1
- ui/shared/txt2img_ui.py +2 -1
- ui/shared/ui_components.py +31 -2
- yaml/file_list.yaml +6 -2
- yaml/image_gen_features.yaml +1 -0
- yaml/injectors.yaml +6 -3
- yaml/model_list.yaml +7 -2
README.md
CHANGED
|
@@ -6,6 +6,7 @@ colorTo: red
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: "5.50.0"
|
| 8 |
app_file: app.py
|
|
|
|
| 9 |
short_description: Multi-task image generator with dynamic, chainable workflows
|
| 10 |
pinned: true
|
| 11 |
models:
|
|
@@ -18,6 +19,7 @@ models:
|
|
| 18 |
- black-forest-labs/FLUX.2-klein-base-4b-fp8
|
| 19 |
- black-forest-labs/FLUX.2-klein-base-9b-fp8
|
| 20 |
- bluepen5805/4nima_pencil-XL
|
|
|
|
| 21 |
- bluepen5805/anima_pencil-XL
|
| 22 |
- bluepen5805/blue_pencil-XL
|
| 23 |
- bluepen5805/illustrious_pencil-XL
|
|
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: "5.50.0"
|
| 8 |
app_file: app.py
|
| 9 |
+
python_version: 3.12
|
| 10 |
short_description: Multi-task image generator with dynamic, chainable workflows
|
| 11 |
pinned: true
|
| 12 |
models:
|
|
|
|
| 19 |
- black-forest-labs/FLUX.2-klein-base-4b-fp8
|
| 20 |
- black-forest-labs/FLUX.2-klein-base-9b-fp8
|
| 21 |
- bluepen5805/4nima_pencil-XL
|
| 22 |
+
- bluepen5805/anima-models
|
| 23 |
- bluepen5805/anima_pencil-XL
|
| 24 |
- bluepen5805/blue_pencil-XL
|
| 25 |
- bluepen5805/illustrious_pencil-XL
|
chain_injectors/hidream_o1_reference_injector.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 7 |
+
if ksampler_name not in assembler.node_map:
|
| 8 |
+
print(f"Warning: KSampler node '{ksampler_name}' not found for HiDream-O1 Reference chain. Skipping.")
|
| 9 |
+
return
|
| 10 |
+
|
| 11 |
+
ksampler_id = assembler.node_map[ksampler_name]
|
| 12 |
+
|
| 13 |
+
if 'positive' not in assembler.workflow[ksampler_id]['inputs'] or 'negative' not in assembler.workflow[ksampler_id]['inputs']:
|
| 14 |
+
print(f"Warning: KSampler node '{ksampler_name}' missing positive/negative inputs. Skipping.")
|
| 15 |
+
return
|
| 16 |
+
|
| 17 |
+
current_pos_conditioning = assembler.workflow[ksampler_id]['inputs']['positive']
|
| 18 |
+
current_neg_conditioning = assembler.workflow[ksampler_id]['inputs']['negative']
|
| 19 |
+
|
| 20 |
+
ref_images_id = assembler._get_unique_id()
|
| 21 |
+
ref_images_node = assembler._get_node_template("HiDreamO1ReferenceImages")
|
| 22 |
+
|
| 23 |
+
if 'images' in ref_images_node['inputs']:
|
| 24 |
+
del ref_images_node['inputs']['images']
|
| 25 |
+
|
| 26 |
+
ref_images_node['inputs']['positive'] = current_pos_conditioning
|
| 27 |
+
ref_images_node['inputs']['negative'] = current_neg_conditioning
|
| 28 |
+
|
| 29 |
+
for i, img_filename in enumerate(chain_items):
|
| 30 |
+
if i >= 10:
|
| 31 |
+
break
|
| 32 |
+
|
| 33 |
+
load_id = assembler._get_unique_id()
|
| 34 |
+
load_node = assembler._get_node_template("LoadImage")
|
| 35 |
+
load_node['inputs']['image'] = img_filename
|
| 36 |
+
load_node['_meta']['title'] = f"Load Reference Image {i+1}"
|
| 37 |
+
assembler.workflow[load_id] = load_node
|
| 38 |
+
|
| 39 |
+
scale_id = assembler._get_unique_id()
|
| 40 |
+
scale_node = assembler._get_node_template("ImageScaleToTotalPixels")
|
| 41 |
+
scale_node['inputs']['megapixels'] = 1.0
|
| 42 |
+
scale_node['inputs']['upscale_method'] = "lanczos"
|
| 43 |
+
scale_node['inputs']['image'] = [load_id, 0]
|
| 44 |
+
scale_node['_meta']['title'] = f"Scale Reference {i+1}"
|
| 45 |
+
assembler.workflow[scale_id] = scale_node
|
| 46 |
+
|
| 47 |
+
ref_images_node['inputs'][f'images.image_{i+1}'] = [scale_id, 0]
|
| 48 |
+
|
| 49 |
+
assembler.workflow[ref_images_id] = ref_images_node
|
| 50 |
+
|
| 51 |
+
assembler.workflow[ksampler_id]['inputs']['positive'] = [ref_images_id, 0]
|
| 52 |
+
assembler.workflow[ksampler_id]['inputs']['negative'] = [ref_images_id, 1]
|
| 53 |
+
|
| 54 |
+
print(f"HiDream-O1 Reference injector applied. Re-routed inputs through {min(len(chain_items), 10)} reference images.")
|
chain_injectors/{hidream_smoothing_injector.py → hidream_o1_smoothing_injector.py}
RENAMED
|
@@ -6,7 +6,7 @@ def inject(assembler, chain_definition, chain_items):
|
|
| 6 |
|
| 7 |
target_node_name = chain_definition.get('target_node')
|
| 8 |
if not target_node_name or target_node_name not in assembler.node_map:
|
| 9 |
-
print(f"Warning: Target node '{target_node_name}' not found for HiDream Smoothing. Skipping.")
|
| 10 |
return
|
| 11 |
|
| 12 |
target_node_id = assembler.node_map[target_node_name]
|
|
|
|
| 6 |
|
| 7 |
target_node_name = chain_definition.get('target_node')
|
| 8 |
if not target_node_name or target_node_name not in assembler.node_map:
|
| 9 |
+
print(f"Warning: Target node '{target_node_name}' not found for HiDream-O1 Smoothing. Skipping.")
|
| 10 |
return
|
| 11 |
|
| 12 |
target_node_id = assembler.node_map[target_node_name]
|
core/pipelines/sd_image_pipeline.py
CHANGED
|
@@ -96,9 +96,17 @@ class SdImagePipeline(BasePipeline):
|
|
| 96 |
raise RuntimeError(f"Workflow integrity error: Output of node {source_node_id} needed for {node_id} but not yet computed.")
|
| 97 |
|
| 98 |
source_output_tuple = computed_outputs[source_node_id]
|
| 99 |
-
|
| 100 |
else:
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
function_name = getattr(node_class, 'FUNCTION')
|
| 104 |
execution_method = getattr(node_instance, function_name)
|
|
@@ -436,6 +444,17 @@ class SdImagePipeline(BasePipeline):
|
|
| 436 |
img.save(temp_path, "PNG")
|
| 437 |
temp_files_to_clean.append(temp_path)
|
| 438 |
active_reference_latents.append(os.path.basename(temp_path))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
|
| 440 |
from utils.app_utils import get_vae_path
|
| 441 |
vae_source = ui_inputs.get('vae_source')
|
|
@@ -491,9 +510,9 @@ class SdImagePipeline(BasePipeline):
|
|
| 491 |
recipe_path = os.path.join(os.path.dirname(__file__), "workflow_recipes", "sd_unified_recipe.yaml")
|
| 492 |
assembler = WorkflowAssembler(recipe_path, dynamic_values=dynamic_values)
|
| 493 |
|
| 494 |
-
|
| 495 |
if workflow_model_type == 'hidream-o1' and model_display_name == "HiDream-O1-Image":
|
| 496 |
-
|
| 497 |
|
| 498 |
workflow_inputs = {
|
| 499 |
**ui_inputs,
|
|
@@ -515,8 +534,9 @@ class SdImagePipeline(BasePipeline):
|
|
| 515 |
"style_chain": active_styles,
|
| 516 |
"conditioning_chain": active_conditioning,
|
| 517 |
"reference_latent_chain": active_reference_latents,
|
|
|
|
| 518 |
"vae_chain": [ui_inputs.get('vae_name')] if ui_inputs.get('vae_name') else [],
|
| 519 |
-
"
|
| 520 |
}
|
| 521 |
|
| 522 |
if isinstance(path_or_components, dict):
|
|
|
|
| 96 |
raise RuntimeError(f"Workflow integrity error: Output of node {source_node_id} needed for {node_id} but not yet computed.")
|
| 97 |
|
| 98 |
source_output_tuple = computed_outputs[source_node_id]
|
| 99 |
+
actual_value = get_value_at_index(source_output_tuple, output_index)
|
| 100 |
else:
|
| 101 |
+
actual_value = param_value
|
| 102 |
+
|
| 103 |
+
if '.' in param_name:
|
| 104 |
+
parent_key, child_key = param_name.split('.', 1)
|
| 105 |
+
if parent_key not in kwargs or not isinstance(kwargs[parent_key], dict):
|
| 106 |
+
kwargs[parent_key] = {}
|
| 107 |
+
kwargs[parent_key][child_key] = actual_value
|
| 108 |
+
else:
|
| 109 |
+
kwargs[param_name] = actual_value
|
| 110 |
|
| 111 |
function_name = getattr(node_class, 'FUNCTION')
|
| 112 |
execution_method = getattr(node_instance, function_name)
|
|
|
|
| 444 |
img.save(temp_path, "PNG")
|
| 445 |
temp_files_to_clean.append(temp_path)
|
| 446 |
active_reference_latents.append(os.path.basename(temp_path))
|
| 447 |
+
|
| 448 |
+
hidream_o1_reference_data = ui_inputs.get('hidream_o1_reference_data', [])
|
| 449 |
+
active_hidream_o1_reference = []
|
| 450 |
+
if hidream_o1_reference_data:
|
| 451 |
+
for img in hidream_o1_reference_data:
|
| 452 |
+
if img:
|
| 453 |
+
if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
|
| 454 |
+
temp_path = os.path.join(INPUT_DIR, f"temp_ho1_ref_{random.randint(1000, 9999)}.png")
|
| 455 |
+
img.save(temp_path, "PNG")
|
| 456 |
+
temp_files_to_clean.append(temp_path)
|
| 457 |
+
active_hidream_o1_reference.append(os.path.basename(temp_path))
|
| 458 |
|
| 459 |
from utils.app_utils import get_vae_path
|
| 460 |
vae_source = ui_inputs.get('vae_source')
|
|
|
|
| 510 |
recipe_path = os.path.join(os.path.dirname(__file__), "workflow_recipes", "sd_unified_recipe.yaml")
|
| 511 |
assembler = WorkflowAssembler(recipe_path, dynamic_values=dynamic_values)
|
| 512 |
|
| 513 |
+
hidream_o1_smoothing_data = []
|
| 514 |
if workflow_model_type == 'hidream-o1' and model_display_name == "HiDream-O1-Image":
|
| 515 |
+
hidream_o1_smoothing_data.append({})
|
| 516 |
|
| 517 |
workflow_inputs = {
|
| 518 |
**ui_inputs,
|
|
|
|
| 534 |
"style_chain": active_styles,
|
| 535 |
"conditioning_chain": active_conditioning,
|
| 536 |
"reference_latent_chain": active_reference_latents,
|
| 537 |
+
"hidream_o1_reference_chain": active_hidream_o1_reference,
|
| 538 |
"vae_chain": [ui_inputs.get('vae_name')] if ui_inputs.get('vae_name') else [],
|
| 539 |
+
"hidream_o1_smoothing_chain": hidream_o1_smoothing_data,
|
| 540 |
}
|
| 541 |
|
| 542 |
if isinstance(path_or_components, dict):
|
core/pipelines/workflow_recipes/_partials/conditioning/hidream-o1.yaml
CHANGED
|
@@ -51,8 +51,8 @@ dynamic_lora_chains:
|
|
| 51 |
"model": ["model_noise_scale:model"]
|
| 52 |
"clip": ["pos_prompt:clip", "neg_prompt:clip"]
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
target_node: "ksampler"
|
| 57 |
|
| 58 |
dynamic_conditioning_chains:
|
|
@@ -60,5 +60,9 @@ dynamic_conditioning_chains:
|
|
| 60 |
ksampler_node: "ksampler"
|
| 61 |
clip_source: "ckpt_loader:1"
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
ui_map:
|
| 64 |
model_name: "ckpt_loader:ckpt_name"
|
|
|
|
| 51 |
"model": ["model_noise_scale:model"]
|
| 52 |
"clip": ["pos_prompt:clip", "neg_prompt:clip"]
|
| 53 |
|
| 54 |
+
dynamic_hidream_o1_smoothing_chains:
|
| 55 |
+
hidream_o1_smoothing_chain:
|
| 56 |
target_node: "ksampler"
|
| 57 |
|
| 58 |
dynamic_conditioning_chains:
|
|
|
|
| 60 |
ksampler_node: "ksampler"
|
| 61 |
clip_source: "ckpt_loader:1"
|
| 62 |
|
| 63 |
+
dynamic_hidream_o1_reference_chains:
|
| 64 |
+
hidream_o1_reference_chain:
|
| 65 |
+
ksampler_node: "ksampler"
|
| 66 |
+
|
| 67 |
ui_map:
|
| 68 |
model_name: "ckpt_loader:ckpt_name"
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
comfyui-frontend-package==1.
|
| 2 |
-
comfyui-workflow-templates==0.9.
|
| 3 |
comfyui-embedded-docs==0.5.0
|
| 4 |
torch
|
| 5 |
torchsde
|
|
@@ -23,7 +23,7 @@ SQLAlchemy>=2.0.0
|
|
| 23 |
filelock
|
| 24 |
av>=14.2.0
|
| 25 |
comfy-kitchen>=0.2.8
|
| 26 |
-
comfy-aimdo==0.
|
| 27 |
requests
|
| 28 |
simpleeval>=1.0.0
|
| 29 |
blake3
|
|
@@ -43,4 +43,4 @@ huggingface-hub
|
|
| 43 |
imageio
|
| 44 |
|
| 45 |
spaces
|
| 46 |
-
sageattention @ https://huggingface.co/RioShiina/Sage-Attention-ZeroGPU-Space-Build/resolve/main/sageattention-2.2.0-
|
|
|
|
| 1 |
+
comfyui-frontend-package==1.44.19
|
| 2 |
+
comfyui-workflow-templates==0.9.82
|
| 3 |
comfyui-embedded-docs==0.5.0
|
| 4 |
torch
|
| 5 |
torchsde
|
|
|
|
| 23 |
filelock
|
| 24 |
av>=14.2.0
|
| 25 |
comfy-kitchen>=0.2.8
|
| 26 |
+
comfy-aimdo==0.4.5
|
| 27 |
requests
|
| 28 |
simpleeval>=1.0.0
|
| 29 |
blake3
|
|
|
|
| 43 |
imageio
|
| 44 |
|
| 45 |
spaces
|
| 46 |
+
sageattention @ https://huggingface.co/RioShiina/Sage-Attention-ZeroGPU-Space-Build/resolve/main/sageattention-2.2.0-cp312-cp312-linux_x86_64.whl
|
ui/events.py
CHANGED
|
@@ -605,6 +605,44 @@ def attach_event_handlers(ui_components, demo):
|
|
| 605 |
add_button.click(fn=add_fipa_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 606 |
del_button.click(fn=del_fipa_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
def create_style_event_handlers(prefix):
|
| 609 |
style_rows = ui_components.get(f'style_rows_{prefix}')
|
| 610 |
if not style_rows: return
|
|
@@ -717,6 +755,37 @@ def attach_event_handlers(ui_components, demo):
|
|
| 717 |
add_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 718 |
del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 719 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 720 |
|
| 721 |
def create_embedding_event_handlers(prefix):
|
| 722 |
rows = ui_components.get(f'embedding_rows_{prefix}')
|
|
@@ -852,6 +921,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 852 |
embedding_data_components = ui_components.get(f'all_embedding_components_flat_{prefix}', [])
|
| 853 |
conditioning_data_components = ui_components.get(f'all_conditioning_components_flat_{prefix}', [])
|
| 854 |
reference_latent_data_components = ui_components.get(f'all_reference_latent_components_flat_{prefix}', [])
|
|
|
|
| 855 |
|
| 856 |
run_inputs_map['vae_source'] = ui_components.get(f'vae_source_{prefix}')
|
| 857 |
run_inputs_map['vae_id'] = ui_components.get(f'vae_id_{prefix}')
|
|
@@ -862,7 +932,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 862 |
all_chains = [
|
| 863 |
lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, ipadapter_data_components,
|
| 864 |
sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,
|
| 865 |
-
embedding_data_components, conditioning_data_components, reference_latent_data_components
|
| 866 |
]
|
| 867 |
for chain in all_chains:
|
| 868 |
if chain:
|
|
@@ -890,6 +960,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 890 |
assign_chain_data('embedding_data', embedding_data_components)
|
| 891 |
assign_chain_data('conditioning_data', conditioning_data_components)
|
| 892 |
assign_chain_data('reference_latent_data', reference_latent_data_components)
|
|
|
|
| 893 |
|
| 894 |
return ui_dict
|
| 895 |
|
|
@@ -902,7 +973,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 902 |
outputs=[res_gal]
|
| 903 |
)
|
| 904 |
|
| 905 |
-
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):
|
| 906 |
def update_fn(*args):
|
| 907 |
arch = args[0]
|
| 908 |
category = args[1]
|
|
@@ -953,6 +1024,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 953 |
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 954 |
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 955 |
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
|
|
|
| 956 |
|
| 957 |
if cs_comp:
|
| 958 |
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
|
@@ -1016,7 +1088,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1016 |
return updates
|
| 1017 |
return update_fn
|
| 1018 |
|
| 1019 |
-
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):
|
| 1020 |
def change_fn(*args):
|
| 1021 |
model_name = args[0]
|
| 1022 |
idx = 1
|
|
@@ -1071,6 +1143,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1071 |
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 1072 |
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 1073 |
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
|
|
|
| 1074 |
|
| 1075 |
if cs_comp:
|
| 1076 |
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
|
@@ -1172,6 +1245,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1172 |
embedding_accordion = ui_components.get(f'embedding_accordion_{prefix}')
|
| 1173 |
conditioning_accordion = ui_components.get(f'conditioning_accordion_{prefix}')
|
| 1174 |
ref_latent_accordion = ui_components.get(f'reference_latent_accordion_{prefix}')
|
|
|
|
| 1175 |
|
| 1176 |
ipa_preset_list = ui_components.get(f'ipadapter_final_preset_{prefix}')
|
| 1177 |
|
|
@@ -1204,6 +1278,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1204 |
if embedding_accordion: outputs.append(embedding_accordion)
|
| 1205 |
if conditioning_accordion: outputs.append(conditioning_accordion)
|
| 1206 |
if ref_latent_accordion: outputs.append(ref_latent_accordion)
|
|
|
|
| 1207 |
if ipa_preset_list: outputs.append(ipa_preset_list)
|
| 1208 |
|
| 1209 |
outputs.extend(valid_extra_comps)
|
|
@@ -1214,7 +1289,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1214 |
anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
|
| 1215 |
diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
|
| 1216 |
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,
|
| 1217 |
-
ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
|
| 1218 |
)
|
| 1219 |
inputs = [arch_comp, cat_comp]
|
| 1220 |
if aspect_ratio_comp:
|
|
@@ -1243,6 +1318,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1243 |
if embedding_accordion: outputs2.append(embedding_accordion)
|
| 1244 |
if conditioning_accordion: outputs2.append(conditioning_accordion)
|
| 1245 |
if ref_latent_accordion: outputs2.append(ref_latent_accordion)
|
|
|
|
| 1246 |
if ipa_preset_list: outputs2.append(ipa_preset_list)
|
| 1247 |
|
| 1248 |
outputs2.extend(valid_extra_comps)
|
|
@@ -1258,7 +1334,7 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1258 |
anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
|
| 1259 |
diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
|
| 1260 |
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,
|
| 1261 |
-
ref_latent_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
|
| 1262 |
)
|
| 1263 |
model_comp.change(fn=change_fn, inputs=inputs2, outputs=outputs2)
|
| 1264 |
|
|
@@ -1270,8 +1346,10 @@ def attach_event_handlers(ui_components, demo):
|
|
| 1270 |
create_embedding_event_handlers(prefix)
|
| 1271 |
create_conditioning_event_handlers(prefix)
|
| 1272 |
create_flux1_ipadapter_event_handlers(prefix)
|
|
|
|
| 1273 |
create_style_event_handlers(prefix)
|
| 1274 |
create_reference_latent_event_handlers(prefix)
|
|
|
|
| 1275 |
create_run_event(prefix, task_type)
|
| 1276 |
|
| 1277 |
|
|
|
|
| 605 |
add_button.click(fn=add_fipa_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 606 |
del_button.click(fn=del_fipa_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 607 |
|
| 608 |
+
def create_sd3_ipadapter_event_handlers(prefix):
|
| 609 |
+
ipa_rows = ui_components.get(f'sd3_ipadapter_rows_{prefix}')
|
| 610 |
+
if not ipa_rows: return
|
| 611 |
+
count_state = ui_components[f'sd3_ipadapter_count_state_{prefix}']
|
| 612 |
+
add_button = ui_components[f'add_sd3_ipadapter_button_{prefix}']
|
| 613 |
+
del_button = ui_components[f'delete_sd3_ipadapter_button_{prefix}']
|
| 614 |
+
images = ui_components[f'sd3_ipadapter_images_{prefix}']
|
| 615 |
+
weights = ui_components[f'sd3_ipadapter_weights_{prefix}']
|
| 616 |
+
start_percents = ui_components[f'sd3_ipadapter_start_percents_{prefix}']
|
| 617 |
+
end_percents = ui_components[f'sd3_ipadapter_end_percents_{prefix}']
|
| 618 |
+
|
| 619 |
+
def add_ipa_row(c):
|
| 620 |
+
c += 1
|
| 621 |
+
return {
|
| 622 |
+
count_state: c,
|
| 623 |
+
ipa_rows[c - 1]: gr.update(visible=True),
|
| 624 |
+
add_button: gr.update(visible=c < MAX_IPADAPTERS),
|
| 625 |
+
del_button: gr.update(visible=True),
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
def del_ipa_row(c):
|
| 629 |
+
c -= 1
|
| 630 |
+
return {
|
| 631 |
+
count_state: c,
|
| 632 |
+
ipa_rows[c]: gr.update(visible=False),
|
| 633 |
+
images[c]: None,
|
| 634 |
+
weights[c]: 0.5,
|
| 635 |
+
start_percents[c]: 0.0,
|
| 636 |
+
end_percents[c]: 1.0,
|
| 637 |
+
add_button: gr.update(visible=True),
|
| 638 |
+
del_button: gr.update(visible=c > 0),
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
add_outputs = [count_state, add_button, del_button] + ipa_rows
|
| 642 |
+
del_outputs = [count_state, add_button, del_button] + ipa_rows + images + weights + start_percents + end_percents
|
| 643 |
+
add_button.click(fn=add_ipa_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 644 |
+
del_button.click(fn=del_ipa_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 645 |
+
|
| 646 |
def create_style_event_handlers(prefix):
|
| 647 |
style_rows = ui_components.get(f'style_rows_{prefix}')
|
| 648 |
if not style_rows: return
|
|
|
|
| 755 |
add_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 756 |
del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 757 |
|
| 758 |
+
def create_hidream_o1_reference_event_handlers(prefix):
|
| 759 |
+
ref_rows = ui_components.get(f'hidream_o1_reference_rows_{prefix}')
|
| 760 |
+
if not ref_rows: return
|
| 761 |
+
count_state = ui_components[f'hidream_o1_reference_count_state_{prefix}']
|
| 762 |
+
add_button = ui_components[f'add_hidream_o1_reference_button_{prefix}']
|
| 763 |
+
del_button = ui_components[f'delete_hidream_o1_reference_button_{prefix}']
|
| 764 |
+
images = ui_components[f'hidream_o1_reference_images_{prefix}']
|
| 765 |
+
|
| 766 |
+
def add_ref_row(c):
|
| 767 |
+
c += 1
|
| 768 |
+
return {
|
| 769 |
+
count_state: c,
|
| 770 |
+
ref_rows[c - 1]: gr.update(visible=True),
|
| 771 |
+
add_button: gr.update(visible=c < 10),
|
| 772 |
+
del_button: gr.update(visible=True),
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
+
def del_ref_row(c):
|
| 776 |
+
c -= 1
|
| 777 |
+
return {
|
| 778 |
+
count_state: c,
|
| 779 |
+
ref_rows[c]: gr.update(visible=False),
|
| 780 |
+
images[c]: None,
|
| 781 |
+
add_button: gr.update(visible=True),
|
| 782 |
+
del_button: gr.update(visible=c > 0),
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
add_outputs = [count_state, add_button, del_button] + ref_rows
|
| 786 |
+
del_outputs = [count_state, add_button, del_button] + ref_rows + images
|
| 787 |
+
add_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
|
| 788 |
+
del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
|
| 789 |
|
| 790 |
def create_embedding_event_handlers(prefix):
|
| 791 |
rows = ui_components.get(f'embedding_rows_{prefix}')
|
|
|
|
| 921 |
embedding_data_components = ui_components.get(f'all_embedding_components_flat_{prefix}', [])
|
| 922 |
conditioning_data_components = ui_components.get(f'all_conditioning_components_flat_{prefix}', [])
|
| 923 |
reference_latent_data_components = ui_components.get(f'all_reference_latent_components_flat_{prefix}', [])
|
| 924 |
+
hidream_o1_reference_data_components = ui_components.get(f'all_hidream_o1_reference_components_flat_{prefix}', [])
|
| 925 |
|
| 926 |
run_inputs_map['vae_source'] = ui_components.get(f'vae_source_{prefix}')
|
| 927 |
run_inputs_map['vae_id'] = ui_components.get(f'vae_id_{prefix}')
|
|
|
|
| 932 |
all_chains = [
|
| 933 |
lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, ipadapter_data_components,
|
| 934 |
sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,
|
| 935 |
+
embedding_data_components, conditioning_data_components, reference_latent_data_components, hidream_o1_reference_data_components
|
| 936 |
]
|
| 937 |
for chain in all_chains:
|
| 938 |
if chain:
|
|
|
|
| 960 |
assign_chain_data('embedding_data', embedding_data_components)
|
| 961 |
assign_chain_data('conditioning_data', conditioning_data_components)
|
| 962 |
assign_chain_data('reference_latent_data', reference_latent_data_components)
|
| 963 |
+
assign_chain_data('hidream_o1_reference_data', hidream_o1_reference_data_components)
|
| 964 |
|
| 965 |
return ui_dict
|
| 966 |
|
|
|
|
| 973 |
outputs=[res_gal]
|
| 974 |
)
|
| 975 |
|
| 976 |
+
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, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
|
| 977 |
def update_fn(*args):
|
| 978 |
arch = args[0]
|
| 979 |
category = args[1]
|
|
|
|
| 1024 |
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 1025 |
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 1026 |
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 1027 |
+
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 1028 |
|
| 1029 |
if cs_comp:
|
| 1030 |
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
|
|
|
| 1088 |
return updates
|
| 1089 |
return update_fn
|
| 1090 |
|
| 1091 |
+
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, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp):
|
| 1092 |
def change_fn(*args):
|
| 1093 |
model_name = args[0]
|
| 1094 |
idx = 1
|
|
|
|
| 1143 |
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 1144 |
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 1145 |
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 1146 |
+
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 1147 |
|
| 1148 |
if cs_comp:
|
| 1149 |
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
|
|
|
| 1245 |
embedding_accordion = ui_components.get(f'embedding_accordion_{prefix}')
|
| 1246 |
conditioning_accordion = ui_components.get(f'conditioning_accordion_{prefix}')
|
| 1247 |
ref_latent_accordion = ui_components.get(f'reference_latent_accordion_{prefix}')
|
| 1248 |
+
hidream_o1_ref_accordion = ui_components.get(f'hidream_o1_reference_accordion_{prefix}')
|
| 1249 |
|
| 1250 |
ipa_preset_list = ui_components.get(f'ipadapter_final_preset_{prefix}')
|
| 1251 |
|
|
|
|
| 1278 |
if embedding_accordion: outputs.append(embedding_accordion)
|
| 1279 |
if conditioning_accordion: outputs.append(conditioning_accordion)
|
| 1280 |
if ref_latent_accordion: outputs.append(ref_latent_accordion)
|
| 1281 |
+
if hidream_o1_ref_accordion: outputs.append(hidream_o1_ref_accordion)
|
| 1282 |
if ipa_preset_list: outputs.append(ipa_preset_list)
|
| 1283 |
|
| 1284 |
outputs.extend(valid_extra_comps)
|
|
|
|
| 1289 |
anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
|
| 1290 |
diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
|
| 1291 |
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,
|
| 1292 |
+
ref_latent_accordion, hidream_o1_ref_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
|
| 1293 |
)
|
| 1294 |
inputs = [arch_comp, cat_comp]
|
| 1295 |
if aspect_ratio_comp:
|
|
|
|
| 1318 |
if embedding_accordion: outputs2.append(embedding_accordion)
|
| 1319 |
if conditioning_accordion: outputs2.append(conditioning_accordion)
|
| 1320 |
if ref_latent_accordion: outputs2.append(ref_latent_accordion)
|
| 1321 |
+
if hidream_o1_ref_accordion: outputs2.append(hidream_o1_ref_accordion)
|
| 1322 |
if ipa_preset_list: outputs2.append(ipa_preset_list)
|
| 1323 |
|
| 1324 |
outputs2.extend(valid_extra_comps)
|
|
|
|
| 1334 |
anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,
|
| 1335 |
diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
|
| 1336 |
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,
|
| 1337 |
+
ref_latent_accordion, hidream_o1_ref_accordion, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp
|
| 1338 |
)
|
| 1339 |
model_comp.change(fn=change_fn, inputs=inputs2, outputs=outputs2)
|
| 1340 |
|
|
|
|
| 1346 |
create_embedding_event_handlers(prefix)
|
| 1347 |
create_conditioning_event_handlers(prefix)
|
| 1348 |
create_flux1_ipadapter_event_handlers(prefix)
|
| 1349 |
+
create_sd3_ipadapter_event_handlers(prefix)
|
| 1350 |
create_style_event_handlers(prefix)
|
| 1351 |
create_reference_latent_event_handlers(prefix)
|
| 1352 |
+
create_hidream_o1_reference_event_handlers(prefix)
|
| 1353 |
create_run_event(prefix, task_type)
|
| 1354 |
|
| 1355 |
|
ui/shared/hires_fix_ui.py
CHANGED
|
@@ -7,7 +7,7 @@ from .ui_components import (
|
|
| 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,
|
| 10 |
-
create_reference_latent_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
@@ -82,6 +82,7 @@ def create_ui():
|
|
| 82 |
components.update(create_embedding_ui(prefix))
|
| 83 |
components.update(create_conditioning_ui(prefix))
|
| 84 |
components.update(create_reference_latent_ui(prefix))
|
|
|
|
| 85 |
components.update(create_vae_override_ui(prefix))
|
| 86 |
|
| 87 |
return components
|
|
|
|
| 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,
|
| 10 |
+
create_reference_latent_ui, create_hidream_o1_reference_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
|
|
| 82 |
components.update(create_embedding_ui(prefix))
|
| 83 |
components.update(create_conditioning_ui(prefix))
|
| 84 |
components.update(create_reference_latent_ui(prefix))
|
| 85 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 86 |
components.update(create_vae_override_ui(prefix))
|
| 87 |
|
| 88 |
return components
|
ui/shared/img2img_ui.py
CHANGED
|
@@ -7,7 +7,7 @@ from .ui_components import (
|
|
| 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,
|
| 10 |
-
create_reference_latent_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
@@ -64,6 +64,7 @@ def create_ui():
|
|
| 64 |
components.update(create_style_ui(prefix))
|
| 65 |
components.update(create_conditioning_ui(prefix))
|
| 66 |
components.update(create_reference_latent_ui(prefix))
|
|
|
|
| 67 |
components.update(create_vae_override_ui(prefix))
|
| 68 |
|
| 69 |
return components
|
|
|
|
| 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,
|
| 10 |
+
create_reference_latent_ui, create_hidream_o1_reference_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
|
|
| 64 |
components.update(create_style_ui(prefix))
|
| 65 |
components.update(create_conditioning_ui(prefix))
|
| 66 |
components.update(create_reference_latent_ui(prefix))
|
| 67 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 68 |
components.update(create_vae_override_ui(prefix))
|
| 69 |
|
| 70 |
return components
|
ui/shared/inpaint_ui.py
CHANGED
|
@@ -6,7 +6,7 @@ from .ui_components import (
|
|
| 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,
|
| 9 |
-
create_reference_latent_ui
|
| 10 |
)
|
| 11 |
|
| 12 |
def create_ui():
|
|
@@ -96,6 +96,7 @@ def create_ui():
|
|
| 96 |
components.update(create_embedding_ui(prefix))
|
| 97 |
components.update(create_conditioning_ui(prefix))
|
| 98 |
components.update(create_reference_latent_ui(prefix))
|
|
|
|
| 99 |
components.update(create_vae_override_ui(prefix))
|
| 100 |
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 101 |
|
|
|
|
| 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,
|
| 9 |
+
create_reference_latent_ui, create_hidream_o1_reference_ui
|
| 10 |
)
|
| 11 |
|
| 12 |
def create_ui():
|
|
|
|
| 96 |
components.update(create_embedding_ui(prefix))
|
| 97 |
components.update(create_conditioning_ui(prefix))
|
| 98 |
components.update(create_reference_latent_ui(prefix))
|
| 99 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 100 |
components.update(create_vae_override_ui(prefix))
|
| 101 |
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 102 |
|
ui/shared/outpaint_ui.py
CHANGED
|
@@ -7,7 +7,7 @@ from .ui_components import (
|
|
| 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,
|
| 10 |
-
create_reference_latent_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
@@ -79,6 +79,7 @@ def create_ui():
|
|
| 79 |
components.update(create_embedding_ui(prefix))
|
| 80 |
components.update(create_conditioning_ui(prefix))
|
| 81 |
components.update(create_reference_latent_ui(prefix))
|
|
|
|
| 82 |
components.update(create_vae_override_ui(prefix))
|
| 83 |
|
| 84 |
return components
|
|
|
|
| 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,
|
| 10 |
+
create_reference_latent_ui, create_hidream_o1_reference_ui
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
|
|
| 79 |
components.update(create_embedding_ui(prefix))
|
| 80 |
components.update(create_conditioning_ui(prefix))
|
| 81 |
components.update(create_reference_latent_ui(prefix))
|
| 82 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 83 |
components.update(create_vae_override_ui(prefix))
|
| 84 |
|
| 85 |
return components
|
ui/shared/txt2img_ui.py
CHANGED
|
@@ -6,7 +6,7 @@ from .ui_components import (
|
|
| 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,
|
| 9 |
-
create_reference_latent_ui
|
| 10 |
)
|
| 11 |
|
| 12 |
def create_ui():
|
|
@@ -51,6 +51,7 @@ def create_ui():
|
|
| 51 |
components.update(create_style_ui(prefix))
|
| 52 |
components.update(create_conditioning_ui(prefix))
|
| 53 |
components.update(create_reference_latent_ui(prefix))
|
|
|
|
| 54 |
components.update(create_vae_override_ui(prefix))
|
| 55 |
|
| 56 |
return components
|
|
|
|
| 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,
|
| 9 |
+
create_reference_latent_ui, create_hidream_o1_reference_ui
|
| 10 |
)
|
| 11 |
|
| 12 |
def create_ui():
|
|
|
|
| 51 |
components.update(create_style_ui(prefix))
|
| 52 |
components.update(create_conditioning_ui(prefix))
|
| 53 |
components.update(create_reference_latent_ui(prefix))
|
| 54 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 55 |
components.update(create_vae_override_ui(prefix))
|
| 56 |
|
| 57 |
return components
|
ui/shared/ui_components.py
CHANGED
|
@@ -535,7 +535,7 @@ def create_conditioning_ui(prefix: str):
|
|
| 535 |
components[key('all_conditioning_components_flat')] = all_cond_components_flat
|
| 536 |
|
| 537 |
return components
|
| 538 |
-
|
| 539 |
def on_vae_upload(file_obj):
|
| 540 |
if not file_obj:
|
| 541 |
return gr.update(), gr.update(), None
|
|
@@ -588,7 +588,7 @@ def create_reference_latent_ui(prefix: str, max_units=10):
|
|
| 588 |
|
| 589 |
with gr.Accordion("Reference Edit Settings", open=False, visible=('reference_latent' in default_enabled_chains)) as ref_accordion:
|
| 590 |
components[key('reference_latent_accordion')] = ref_accordion
|
| 591 |
-
gr.Markdown("💡 **Tip:** For multimodal models
|
| 592 |
|
| 593 |
ref_image_groups = []
|
| 594 |
ref_image_inputs = []
|
|
@@ -609,4 +609,33 @@ def create_reference_latent_ui(prefix: str, max_units=10):
|
|
| 609 |
|
| 610 |
components[key('all_reference_latent_components_flat')] = ref_image_inputs
|
| 611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
return components
|
|
|
|
| 535 |
components[key('all_conditioning_components_flat')] = all_cond_components_flat
|
| 536 |
|
| 537 |
return components
|
| 538 |
+
|
| 539 |
def on_vae_upload(file_obj):
|
| 540 |
if not file_obj:
|
| 541 |
return gr.update(), gr.update(), None
|
|
|
|
| 588 |
|
| 589 |
with gr.Accordion("Reference Edit Settings", open=False, visible=('reference_latent' in default_enabled_chains)) as ref_accordion:
|
| 590 |
components[key('reference_latent_accordion')] = ref_accordion
|
| 591 |
+
gr.Markdown("💡 **Tip:** For multimodal models, this feature enables powerful editing and combining capabilities. In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")
|
| 592 |
|
| 593 |
ref_image_groups = []
|
| 594 |
ref_image_inputs = []
|
|
|
|
| 609 |
|
| 610 |
components[key('all_reference_latent_components_flat')] = ref_image_inputs
|
| 611 |
|
| 612 |
+
return components
|
| 613 |
+
|
| 614 |
+
def create_hidream_o1_reference_ui(prefix: str, max_units=10):
|
| 615 |
+
components = {}
|
| 616 |
+
key = lambda name: f"{name}_{prefix}"
|
| 617 |
+
|
| 618 |
+
with gr.Accordion("HiDream-O1 Reference Edit Settings", open=False, visible=('hidream_o1_reference' in default_enabled_chains)) as ref_accordion:
|
| 619 |
+
components[key('hidream_o1_reference_accordion')] = ref_accordion
|
| 620 |
+
gr.Markdown("💡 **Tip:** Please use **HiDream-O1-Image-Dev** (HiDream-O1-Image will time out), and set the resolution to **2.0MP** (e.g., 2048x2048). In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")
|
| 621 |
+
|
| 622 |
+
ref_image_groups = []
|
| 623 |
+
ref_image_inputs = []
|
| 624 |
+
with gr.Row():
|
| 625 |
+
for i in range(max_units):
|
| 626 |
+
with gr.Column(visible=(i < 1), min_width=160) as img_col:
|
| 627 |
+
img_comp = gr.Image(type="pil", label=f"Ref. {i+1}", sources=["upload"], height=150)
|
| 628 |
+
ref_image_groups.append(img_col)
|
| 629 |
+
ref_image_inputs.append(img_comp)
|
| 630 |
+
|
| 631 |
+
components[key('hidream_o1_reference_rows')] = ref_image_groups
|
| 632 |
+
components[key('hidream_o1_reference_images')] = ref_image_inputs
|
| 633 |
+
|
| 634 |
+
with gr.Row():
|
| 635 |
+
components[key('add_hidream_o1_reference_button')] = gr.Button("✚ Add Reference Image")
|
| 636 |
+
components[key('delete_hidream_o1_reference_button')] = gr.Button("➖ Delete Reference Image", visible=False)
|
| 637 |
+
components[key('hidream_o1_reference_count_state')] = gr.State(1)
|
| 638 |
+
|
| 639 |
+
components[key('all_hidream_o1_reference_components_flat')] = ref_image_inputs
|
| 640 |
+
|
| 641 |
return components
|
yaml/file_list.yaml
CHANGED
|
@@ -412,10 +412,14 @@ file:
|
|
| 412 |
source: "hf"
|
| 413 |
repo_id: "circlestone-labs/Anima"
|
| 414 |
repository_file_path: "split_files/diffusion_models/anima-base-v1.0.safetensors"
|
| 415 |
-
- filename: "
|
| 416 |
source: "hf"
|
| 417 |
repo_id: "duongve/AnimaYume"
|
| 418 |
-
repository_file_path: "split_files/diffusion_models/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
# NewBie-Image
|
| 420 |
- filename: "NewBie-Image-Exp0.1-bf16.safetensors"
|
| 421 |
source: "hf"
|
|
|
|
| 412 |
source: "hf"
|
| 413 |
repo_id: "circlestone-labs/Anima"
|
| 414 |
repository_file_path: "split_files/diffusion_models/anima-base-v1.0.safetensors"
|
| 415 |
+
- filename: "AnimaYume_tuned_v05.safetensors"
|
| 416 |
source: "hf"
|
| 417 |
repo_id: "duongve/AnimaYume"
|
| 418 |
+
repository_file_path: "split_files/diffusion_models/AnimaYume_tuned_v05.safetensors"
|
| 419 |
+
- filename: "anima_pencil-v1.0.0.safetensors"
|
| 420 |
+
source: "hf"
|
| 421 |
+
repo_id: "bluepen5805/anima-models"
|
| 422 |
+
repository_file_path: "anima_pencil-v1.0.0.safetensors"
|
| 423 |
# NewBie-Image
|
| 424 |
- filename: "NewBie-Image-Exp0.1-bf16.safetensors"
|
| 425 |
source: "hf"
|
yaml/image_gen_features.yaml
CHANGED
|
@@ -104,6 +104,7 @@ hidream-o1:
|
|
| 104 |
enabled_chains:
|
| 105 |
- lora
|
| 106 |
- conditioning
|
|
|
|
| 107 |
|
| 108 |
hidream-i1:
|
| 109 |
enabled_chains:
|
|
|
|
| 104 |
enabled_chains:
|
| 105 |
- lora
|
| 106 |
- conditioning
|
| 107 |
+
- hidream_o1_reference
|
| 108 |
|
| 109 |
hidream-i1:
|
| 110 |
enabled_chains:
|
yaml/injectors.yaml
CHANGED
|
@@ -23,8 +23,10 @@ injector_definitions:
|
|
| 23 |
module: "chain_injectors.conditioning_injector"
|
| 24 |
dynamic_style_chains:
|
| 25 |
module: "chain_injectors.style_injector"
|
| 26 |
-
|
| 27 |
-
module: "chain_injectors.
|
|
|
|
|
|
|
| 28 |
|
| 29 |
injector_order:
|
| 30 |
- dynamic_vae_chains
|
|
@@ -39,4 +41,5 @@ injector_order:
|
|
| 39 |
- dynamic_style_chains
|
| 40 |
- dynamic_controlnet_chains
|
| 41 |
- dynamic_anima_controlnet_lllite_chains
|
| 42 |
-
-
|
|
|
|
|
|
| 23 |
module: "chain_injectors.conditioning_injector"
|
| 24 |
dynamic_style_chains:
|
| 25 |
module: "chain_injectors.style_injector"
|
| 26 |
+
dynamic_hidream_o1_smoothing_chains:
|
| 27 |
+
module: "chain_injectors.hidream_o1_smoothing_injector"
|
| 28 |
+
dynamic_hidream_o1_reference_chains:
|
| 29 |
+
module: "chain_injectors.hidream_o1_reference_injector"
|
| 30 |
|
| 31 |
injector_order:
|
| 32 |
- dynamic_vae_chains
|
|
|
|
| 41 |
- dynamic_style_chains
|
| 42 |
- dynamic_controlnet_chains
|
| 43 |
- dynamic_anima_controlnet_lllite_chains
|
| 44 |
+
- dynamic_hidream_o1_smoothing_chains
|
| 45 |
+
- dynamic_hidream_o1_reference_chains
|
yaml/model_list.yaml
CHANGED
|
@@ -92,9 +92,14 @@ Checkpoint:
|
|
| 92 |
unet: "waiANIMA_v10.safetensors"
|
| 93 |
vae: "qwen_image_vae.safetensors"
|
| 94 |
clip: "qwen_3_06b_base.safetensors"
|
| 95 |
-
- display_name: "duongve/AnimaYume-v0.
|
| 96 |
components:
|
| 97 |
-
unet: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
vae: "qwen_image_vae.safetensors"
|
| 99 |
clip: "qwen_3_06b_base.safetensors"
|
| 100 |
- display_name: "circlestone-labs/Anima-base-v1.0"
|
|
|
|
| 92 |
unet: "waiANIMA_v10.safetensors"
|
| 93 |
vae: "qwen_image_vae.safetensors"
|
| 94 |
clip: "qwen_3_06b_base.safetensors"
|
| 95 |
+
- display_name: "duongve/AnimaYume-v0.5"
|
| 96 |
components:
|
| 97 |
+
unet: "AnimaYume_tuned_v05.safetensors"
|
| 98 |
+
vae: "qwen_image_vae.safetensors"
|
| 99 |
+
clip: "qwen_3_06b_base.safetensors"
|
| 100 |
+
- display_name: "bluepen5805/Anima-pencil-v1.0"
|
| 101 |
+
components:
|
| 102 |
+
unet: "anima_pencil-v1.0.0.safetensors"
|
| 103 |
vae: "qwen_image_vae.safetensors"
|
| 104 |
clip: "qwen_3_06b_base.safetensors"
|
| 105 |
- display_name: "circlestone-labs/Anima-base-v1.0"
|