Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_templates.py
Browse files- inpainting_templates.py +19 -17
inpainting_templates.py
CHANGED
|
@@ -32,6 +32,10 @@ class InpaintingTemplate:
|
|
| 32 |
# Conditioning type preference
|
| 33 |
preferred_conditioning: str = "canny" # "canny" or "depth"
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
# Prompt enhancement control
|
| 36 |
enhance_prompt: bool = True # Whether to use OpenCLIP prompt enhancement
|
| 37 |
|
|
@@ -64,34 +68,31 @@ class InpaintingTemplateManager:
|
|
| 64 |
# 4 CORE TEMPLATES - Optimized for Speed & Quality
|
| 65 |
# ========================================
|
| 66 |
|
| 67 |
-
# 1. CHANGE COLOR - Pure color transformation
|
| 68 |
"change_color": InpaintingTemplate(
|
| 69 |
key="change_color",
|
| 70 |
name="Change Color",
|
| 71 |
category="Color",
|
| 72 |
icon="🎨",
|
| 73 |
-
description="Change color ONLY -
|
| 74 |
-
prompt_template="
|
| 75 |
negative_prompt=(
|
| 76 |
"original color, keeping same color, unchanged color, "
|
| 77 |
"black, dark, keeping black, maintaining black color, "
|
| 78 |
"black clothing, dark colors, dark fabric, black fabric, "
|
| 79 |
-
"
|
| 80 |
-
"texture
|
| 81 |
-
"
|
| 82 |
-
"
|
| 83 |
-
"uniform, military uniform, military clothing, military outfit, army uniform, "
|
| 84 |
-
"style change, clothing design change, fashion change, outfit change, "
|
| 85 |
-
"costume, formal wear, changing garment type, different clothing style, "
|
| 86 |
-
"suit, jacket, vest, coat, dress uniform"
|
| 87 |
),
|
| 88 |
-
controlnet_conditioning_scale=0.
|
| 89 |
-
feather_radius=
|
| 90 |
-
guidance_scale=
|
| 91 |
num_inference_steps=10, # Optimized for speed
|
| 92 |
-
strength=1.0, # Full repaint
|
| 93 |
-
preferred_conditioning="canny", # Edge-based
|
| 94 |
-
|
|
|
|
| 95 |
difficulty="easy",
|
| 96 |
usage_tips=[
|
| 97 |
"🎯 Purpose: Pure color transformation (any object type)",
|
|
@@ -377,6 +378,7 @@ class InpaintingTemplateManager:
|
|
| 377 |
"num_inference_steps": template.num_inference_steps,
|
| 378 |
"strength": template.strength,
|
| 379 |
"preferred_conditioning": template.preferred_conditioning,
|
|
|
|
| 380 |
"enhance_prompt": template.enhance_prompt
|
| 381 |
}
|
| 382 |
|
|
|
|
| 32 |
# Conditioning type preference
|
| 33 |
preferred_conditioning: str = "canny" # "canny" or "depth"
|
| 34 |
|
| 35 |
+
# Structure preservation in masked area
|
| 36 |
+
# True = keep edges in mask (for color change), False = clear edges (for replacement/removal)
|
| 37 |
+
preserve_structure_in_mask: bool = False
|
| 38 |
+
|
| 39 |
# Prompt enhancement control
|
| 40 |
enhance_prompt: bool = True # Whether to use OpenCLIP prompt enhancement
|
| 41 |
|
|
|
|
| 68 |
# 4 CORE TEMPLATES - Optimized for Speed & Quality
|
| 69 |
# ========================================
|
| 70 |
|
| 71 |
+
# 1. CHANGE COLOR - Pure color transformation (preserves structure)
|
| 72 |
"change_color": InpaintingTemplate(
|
| 73 |
key="change_color",
|
| 74 |
name="Change Color",
|
| 75 |
category="Color",
|
| 76 |
icon="🎨",
|
| 77 |
+
description="Change color ONLY - preserves original structure, only changes the fill color",
|
| 78 |
+
prompt_template="{content} colored, solid {content} color, flat color, same structure",
|
| 79 |
negative_prompt=(
|
| 80 |
"original color, keeping same color, unchanged color, "
|
| 81 |
"black, dark, keeping black, maintaining black color, "
|
| 82 |
"black clothing, dark colors, dark fabric, black fabric, "
|
| 83 |
+
"patterns, floral, stripes, plaid, checkered, decorative patterns, "
|
| 84 |
+
"texture change, material change, fabric change, "
|
| 85 |
+
"new design, different style, style change, "
|
| 86 |
+
"complex patterns, printed patterns, embroidery"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
),
|
| 88 |
+
controlnet_conditioning_scale=0.6, # Medium-high: preserve structure/shape from edges
|
| 89 |
+
feather_radius=4, # Low: clean color boundaries
|
| 90 |
+
guidance_scale=12.0, # High: follow color prompt
|
| 91 |
num_inference_steps=10, # Optimized for speed
|
| 92 |
+
strength=1.0, # Full repaint for color change
|
| 93 |
+
preferred_conditioning="canny", # Edge-based: preserves shape
|
| 94 |
+
preserve_structure_in_mask=True, # KEY: keep edges to preserve clothing structure
|
| 95 |
+
enhance_prompt=False, # Disabled: use color prompt directly
|
| 96 |
difficulty="easy",
|
| 97 |
usage_tips=[
|
| 98 |
"🎯 Purpose: Pure color transformation (any object type)",
|
|
|
|
| 378 |
"num_inference_steps": template.num_inference_steps,
|
| 379 |
"strength": template.strength,
|
| 380 |
"preferred_conditioning": template.preferred_conditioning,
|
| 381 |
+
"preserve_structure_in_mask": template.preserve_structure_in_mask,
|
| 382 |
"enhance_prompt": template.enhance_prompt
|
| 383 |
}
|
| 384 |
|