DawnC commited on
Commit
b98067e
·
verified ·
1 Parent(s): af4e7b9

Update inpainting_templates.py

Browse files
Files changed (1) hide show
  1. 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 - works on any object (clothes, walls, furniture) based on mask",
74
- prompt_template="repaint as {content} color, solid {content} only", # Clear action verb + color instruction
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
- "partial color change, incomplete transformation, "
80
- "texture details, fabric patterns, material description, object names, "
81
- "realistic lighting effects, complex shadows, photorealistic rendering, "
82
- "style description, clothing type, object description, "
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.08, # Minimal: maximum color freedom for extreme transformations
89
- feather_radius=6, # Low: reduces blending with original color
90
- guidance_scale=20.0, # Extremely high: forces complete color transformation
91
  num_inference_steps=10, # Optimized for speed
92
- strength=1.0, # Full repaint: completely replace original color
93
- preferred_conditioning="canny", # Edge-based + mask-aware: preserves shape, allows color change
94
- enhance_prompt=False, # Disabled: avoid interference from object descriptions
 
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