Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_templates.py
Browse files- inpainting_templates.py +53 -48
inpainting_templates.py
CHANGED
|
@@ -68,46 +68,47 @@ class InpaintingTemplateManager:
|
|
| 68 |
# 4 CORE TEMPLATES - Optimized for Speed & Quality
|
| 69 |
# ========================================
|
| 70 |
|
| 71 |
-
# 1. CHANGE COLOR - Pure color transformation
|
| 72 |
"change_color": InpaintingTemplate(
|
| 73 |
key="change_color",
|
| 74 |
name="Change Color",
|
| 75 |
category="Color",
|
| 76 |
icon="🎨",
|
| 77 |
-
description="Change color ONLY -
|
| 78 |
-
prompt_template="{content}
|
| 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 |
-
"
|
| 85 |
-
"
|
|
|
|
| 86 |
"complex patterns, printed patterns, embroidery"
|
| 87 |
),
|
| 88 |
-
controlnet_conditioning_scale=0.
|
| 89 |
feather_radius=4, # Low: clean color boundaries
|
| 90 |
-
guidance_scale=
|
| 91 |
num_inference_steps=10, # Optimized for speed
|
| 92 |
strength=1.0, # Full repaint for color change
|
| 93 |
-
preferred_conditioning="canny", # Edge-based
|
| 94 |
-
preserve_structure_in_mask=
|
| 95 |
enhance_prompt=False, # Disabled: use color prompt directly
|
| 96 |
difficulty="easy",
|
| 97 |
usage_tips=[
|
| 98 |
-
"🎯 Purpose:
|
| 99 |
"",
|
| 100 |
"📝 Example Prompts:",
|
| 101 |
-
" • 'vibrant red' -
|
| 102 |
-
" • 'soft pastel pink' -
|
| 103 |
-
" • 'deep navy blue' -
|
| 104 |
-
" • 'bright yellow' -
|
| 105 |
-
" • 'pure white' -
|
| 106 |
"",
|
| 107 |
"💡 Tips:",
|
| 108 |
-
" • Describe ONLY the color, not the object
|
| 109 |
" • Paint the entire area you want to recolor",
|
| 110 |
-
" •
|
| 111 |
]
|
| 112 |
),
|
| 113 |
|
|
@@ -118,12 +119,13 @@ class InpaintingTemplateManager:
|
|
| 118 |
category="Replacement",
|
| 119 |
icon="👕",
|
| 120 |
description="Change clothing style, material, or design - can include color change",
|
| 121 |
-
prompt_template="{content}
|
| 122 |
negative_prompt=(
|
| 123 |
"wrong body proportions, floating fabric, unrealistic wrinkles, "
|
| 124 |
"mismatched lighting, visible edges, original clothing style, "
|
| 125 |
"keeping same color, original color, faded colors, unchanged appearance, partial change, "
|
| 126 |
-
"black clothing, dark original color, distorted body, naked, nudity"
|
|
|
|
| 127 |
),
|
| 128 |
controlnet_conditioning_scale=0.30, # Medium: preserves body structure, allows clothing change
|
| 129 |
feather_radius=14, # Medium: natural blending with body
|
|
@@ -134,18 +136,19 @@ class InpaintingTemplateManager:
|
|
| 134 |
enhance_prompt=True, # Enabled: enriches clothing details
|
| 135 |
difficulty="easy",
|
| 136 |
usage_tips=[
|
| 137 |
-
"🎯 Purpose: Replace clothing with a
|
| 138 |
"",
|
| 139 |
"📝 Example Prompts:",
|
| 140 |
-
" • '
|
| 141 |
-
" • '
|
| 142 |
-
" • '
|
| 143 |
-
" • '
|
| 144 |
-
" • '
|
|
|
|
| 145 |
"",
|
| 146 |
"💡 Tips:",
|
| 147 |
-
" • Include
|
| 148 |
-
" •
|
| 149 |
" • Body structure is preserved automatically"
|
| 150 |
]
|
| 151 |
),
|
|
@@ -157,12 +160,13 @@ class InpaintingTemplateManager:
|
|
| 157 |
category="Replacement",
|
| 158 |
icon="🔄",
|
| 159 |
description="Replace objects (one type at a time) - all masked areas become the SAME object",
|
| 160 |
-
prompt_template="{content}
|
| 161 |
negative_prompt=(
|
| 162 |
"inconsistent lighting, wrong perspective, mismatched colors, "
|
| 163 |
"visible seams, floating objects, unrealistic placement, original object, "
|
| 164 |
"poorly integrated, disconnected from scene, keeping original, remnants of original, "
|
| 165 |
-
"multiple different objects, mixed objects, various items"
|
|
|
|
| 166 |
),
|
| 167 |
controlnet_conditioning_scale=0.25, # Low-medium: allows complete object replacement
|
| 168 |
feather_radius=10, # Medium: natural scene integration
|
|
@@ -173,19 +177,19 @@ class InpaintingTemplateManager:
|
|
| 173 |
enhance_prompt=True, # Enabled: enriches object details
|
| 174 |
difficulty="medium",
|
| 175 |
usage_tips=[
|
| 176 |
-
"🎯 Purpose: Replace an object
|
| 177 |
"",
|
| 178 |
"📝 Example Prompts:",
|
| 179 |
-
" • 'ceramic vase with
|
| 180 |
-
" • 'modern laptop on
|
| 181 |
-
" • 'stack of vintage books' - classic decoration",
|
| 182 |
-
" • 'potted succulent
|
| 183 |
-
" • 'antique brass lamp' - lighting
|
| 184 |
"",
|
| 185 |
"💡 Tips:",
|
| 186 |
-
" • Replace ONE object type at a time
|
| 187 |
" • Describe what you want, not what you're removing",
|
| 188 |
-
" • Include material and style
|
| 189 |
]
|
| 190 |
),
|
| 191 |
|
|
@@ -196,12 +200,13 @@ class InpaintingTemplateManager:
|
|
| 196 |
category="Removal",
|
| 197 |
icon="🗑️",
|
| 198 |
description="Remove objects and naturally fill with background - describe the background material",
|
| 199 |
-
prompt_template="continue the background with {content}, seamless blending, natural continuation",
|
| 200 |
negative_prompt=(
|
| 201 |
"new object appearing, adding items, inserting objects, "
|
| 202 |
"foreground elements, visible object, thing, item, "
|
| 203 |
"unnatural filling, visible patches, inconsistent texture, "
|
| 204 |
-
"mismatched pattern, color discontinuity, artificial blending"
|
|
|
|
| 205 |
),
|
| 206 |
controlnet_conditioning_scale=0.20, # Low: allows creative background filling
|
| 207 |
feather_radius=12, # Medium: smooth background blending
|
|
@@ -212,19 +217,19 @@ class InpaintingTemplateManager:
|
|
| 212 |
enhance_prompt=False, # Disabled: avoid generating new objects
|
| 213 |
difficulty="medium",
|
| 214 |
usage_tips=[
|
| 215 |
-
"🎯 Purpose: Remove unwanted objects and fill
|
| 216 |
"",
|
| 217 |
"📝 Example Prompts:",
|
| 218 |
-
" • '
|
| 219 |
-
" • '
|
| 220 |
-
" • '
|
| 221 |
-
" • 'beige carpet texture' -
|
| 222 |
-
" • 'clear blue sky with clouds' -
|
| 223 |
"",
|
| 224 |
"💡 Tips:",
|
| 225 |
-
" • Describe the BACKGROUND, not the object
|
| 226 |
-
" • Leave empty to auto-match surrounding
|
| 227 |
-
" • Works best with uniform
|
| 228 |
]
|
| 229 |
),
|
| 230 |
}
|
|
|
|
| 68 |
# 4 CORE TEMPLATES - Optimized for Speed & Quality
|
| 69 |
# ========================================
|
| 70 |
|
| 71 |
+
# 1. CHANGE COLOR - Pure color transformation
|
| 72 |
"change_color": InpaintingTemplate(
|
| 73 |
key="change_color",
|
| 74 |
name="Change Color",
|
| 75 |
category="Color",
|
| 76 |
icon="🎨",
|
| 77 |
+
description="Change color ONLY - fills the masked area with a solid, flat color",
|
| 78 |
+
prompt_template="{content} color, solid flat {content}, uniform color, no patterns, smooth surface",
|
| 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 |
+
"diamond pattern, grid pattern, geometric patterns, "
|
| 85 |
+
"texture, textured, wrinkles, folds, creases, "
|
| 86 |
+
"gradients, shading variations, color variations, "
|
| 87 |
"complex patterns, printed patterns, embroidery"
|
| 88 |
),
|
| 89 |
+
controlnet_conditioning_scale=0.3, # Low-medium: allow color freedom in masked area
|
| 90 |
feather_radius=4, # Low: clean color boundaries
|
| 91 |
+
guidance_scale=15.0, # Very high: strongly follow color prompt
|
| 92 |
num_inference_steps=10, # Optimized for speed
|
| 93 |
strength=1.0, # Full repaint for color change
|
| 94 |
+
preferred_conditioning="canny", # Edge-based
|
| 95 |
+
preserve_structure_in_mask=False, # KEY: clear edges in mask for pure color fill
|
| 96 |
enhance_prompt=False, # Disabled: use color prompt directly
|
| 97 |
difficulty="easy",
|
| 98 |
usage_tips=[
|
| 99 |
+
"🎯 Purpose: Fill the masked area with a solid, uniform color.",
|
| 100 |
"",
|
| 101 |
"📝 Example Prompts:",
|
| 102 |
+
" • 'vibrant red' - bold, saturated red",
|
| 103 |
+
" • 'soft pastel pink' - gentle, light pink",
|
| 104 |
+
" • 'deep navy blue' - rich, dark blue",
|
| 105 |
+
" • 'bright yellow' - eye-catching yellow",
|
| 106 |
+
" • 'pure white' - clean, solid white",
|
| 107 |
"",
|
| 108 |
"💡 Tips:",
|
| 109 |
+
" • Describe ONLY the color, not the object",
|
| 110 |
" • Paint the entire area you want to recolor",
|
| 111 |
+
" • Use modifiers: 'bright', 'dark', 'pastel', 'vivid'"
|
| 112 |
]
|
| 113 |
),
|
| 114 |
|
|
|
|
| 119 |
category="Replacement",
|
| 120 |
icon="👕",
|
| 121 |
description="Change clothing style, material, or design - can include color change",
|
| 122 |
+
prompt_template="{content}, photorealistic, realistic fabric texture, natural fit, high quality",
|
| 123 |
negative_prompt=(
|
| 124 |
"wrong body proportions, floating fabric, unrealistic wrinkles, "
|
| 125 |
"mismatched lighting, visible edges, original clothing style, "
|
| 126 |
"keeping same color, original color, faded colors, unchanged appearance, partial change, "
|
| 127 |
+
"black clothing, dark original color, distorted body, naked, nudity, "
|
| 128 |
+
"cartoon, anime, illustration, drawing, painted"
|
| 129 |
),
|
| 130 |
controlnet_conditioning_scale=0.30, # Medium: preserves body structure, allows clothing change
|
| 131 |
feather_radius=14, # Medium: natural blending with body
|
|
|
|
| 136 |
enhance_prompt=True, # Enabled: enriches clothing details
|
| 137 |
difficulty="easy",
|
| 138 |
usage_tips=[
|
| 139 |
+
"🎯 Purpose: Replace clothing with a different style, material, or design.",
|
| 140 |
"",
|
| 141 |
"📝 Example Prompts:",
|
| 142 |
+
" • 'tailored charcoal suit with silk tie and white shirt' - formal business",
|
| 143 |
+
" • 'navy blazer with gold buttons over light blue oxford shirt' - smart casual",
|
| 144 |
+
" • 'black tuxedo with bow tie and white dress shirt' - elegant formal",
|
| 145 |
+
" • 'white polo shirt with collar' - casual business",
|
| 146 |
+
" • 'cozy cream knit sweater' - warm casual style",
|
| 147 |
+
" • 'vintage denim jacket' - retro fashion",
|
| 148 |
"",
|
| 149 |
"💡 Tips:",
|
| 150 |
+
" • Include clothing type + color + details for best results",
|
| 151 |
+
" • For suits: mention 'tailored', 'fitted', specific fabric like 'wool' or 'silk'",
|
| 152 |
" • Body structure is preserved automatically"
|
| 153 |
]
|
| 154 |
),
|
|
|
|
| 160 |
category="Replacement",
|
| 161 |
icon="🔄",
|
| 162 |
description="Replace objects (one type at a time) - all masked areas become the SAME object",
|
| 163 |
+
prompt_template="{content}, photorealistic, natural lighting, seamlessly integrated into scene, high quality",
|
| 164 |
negative_prompt=(
|
| 165 |
"inconsistent lighting, wrong perspective, mismatched colors, "
|
| 166 |
"visible seams, floating objects, unrealistic placement, original object, "
|
| 167 |
"poorly integrated, disconnected from scene, keeping original, remnants of original, "
|
| 168 |
+
"multiple different objects, mixed objects, various items, "
|
| 169 |
+
"cartoon, anime, illustration, drawing, painted"
|
| 170 |
),
|
| 171 |
controlnet_conditioning_scale=0.25, # Low-medium: allows complete object replacement
|
| 172 |
feather_radius=10, # Medium: natural scene integration
|
|
|
|
| 177 |
enhance_prompt=True, # Enabled: enriches object details
|
| 178 |
difficulty="medium",
|
| 179 |
usage_tips=[
|
| 180 |
+
"🎯 Purpose: Replace an object with something completely different.",
|
| 181 |
"",
|
| 182 |
"📝 Example Prompts:",
|
| 183 |
+
" • 'elegant ceramic vase with fresh roses' - decorative item",
|
| 184 |
+
" • 'modern silver laptop on wooden stand' - tech gadget",
|
| 185 |
+
" • 'stack of leather-bound vintage books' - classic decoration",
|
| 186 |
+
" • 'healthy green potted succulent' - natural element",
|
| 187 |
+
" • 'antique brass table lamp with fabric shade' - lighting",
|
| 188 |
"",
|
| 189 |
"💡 Tips:",
|
| 190 |
+
" • Replace ONE object type at a time",
|
| 191 |
" • Describe what you want, not what you're removing",
|
| 192 |
+
" • Include material and style for realistic results"
|
| 193 |
]
|
| 194 |
),
|
| 195 |
|
|
|
|
| 200 |
category="Removal",
|
| 201 |
icon="🗑️",
|
| 202 |
description="Remove objects and naturally fill with background - describe the background material",
|
| 203 |
+
prompt_template="continue the background with {content}, photorealistic, seamless blending, natural texture continuation, high quality",
|
| 204 |
negative_prompt=(
|
| 205 |
"new object appearing, adding items, inserting objects, "
|
| 206 |
"foreground elements, visible object, thing, item, "
|
| 207 |
"unnatural filling, visible patches, inconsistent texture, "
|
| 208 |
+
"mismatched pattern, color discontinuity, artificial blending, "
|
| 209 |
+
"cartoon, anime, illustration, drawing, painted"
|
| 210 |
),
|
| 211 |
controlnet_conditioning_scale=0.20, # Low: allows creative background filling
|
| 212 |
feather_radius=12, # Medium: smooth background blending
|
|
|
|
| 217 |
enhance_prompt=False, # Disabled: avoid generating new objects
|
| 218 |
difficulty="medium",
|
| 219 |
usage_tips=[
|
| 220 |
+
"🎯 Purpose: Remove unwanted objects and fill with background.",
|
| 221 |
"",
|
| 222 |
"📝 Example Prompts:",
|
| 223 |
+
" • 'polished hardwood floor with natural grain' - indoor floors",
|
| 224 |
+
" • 'smooth white painted wall' - wall backgrounds",
|
| 225 |
+
" • 'lush green grass lawn' - outdoor areas",
|
| 226 |
+
" • 'soft beige carpet texture' - carpeted floors",
|
| 227 |
+
" • 'clear blue sky with soft clouds' - sky backgrounds",
|
| 228 |
"",
|
| 229 |
"💡 Tips:",
|
| 230 |
+
" • Describe the BACKGROUND texture, not the object",
|
| 231 |
+
" • Leave empty to auto-match surrounding area",
|
| 232 |
+
" • Works best with uniform backgrounds"
|
| 233 |
]
|
| 234 |
),
|
| 235 |
}
|