Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_templates.py
Browse files- inpainting_templates.py +11 -1
inpainting_templates.py
CHANGED
|
@@ -25,6 +25,10 @@ class InpaintingTemplate:
|
|
| 25 |
guidance_scale: float = 7.5
|
| 26 |
num_inference_steps: int = 25
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Conditioning type preference
|
| 29 |
preferred_conditioning: str = "canny" # "canny" or "depth"
|
| 30 |
|
|
@@ -85,6 +89,7 @@ class InpaintingTemplateManager:
|
|
| 85 |
feather_radius=6, # Low: reduces blending with original color
|
| 86 |
guidance_scale=20.0, # Extremely high: forces complete color transformation
|
| 87 |
num_inference_steps=10, # Optimized for speed
|
|
|
|
| 88 |
preferred_conditioning="canny", # Edge-based + mask-aware: preserves shape, allows color change
|
| 89 |
enhance_prompt=False, # Disabled: avoid interference from object descriptions
|
| 90 |
difficulty="easy",
|
|
@@ -144,6 +149,7 @@ class InpaintingTemplateManager:
|
|
| 144 |
feather_radius=14, # Medium: natural blending with body
|
| 145 |
guidance_scale=11.5, # Medium-high: accurate clothing generation
|
| 146 |
num_inference_steps=10, # Optimized for speed
|
|
|
|
| 147 |
preferred_conditioning="depth", # Depth: preserves fabric folds and body structure
|
| 148 |
enhance_prompt=True, # Enabled: enriches clothing details
|
| 149 |
difficulty="easy",
|
|
@@ -180,6 +186,7 @@ class InpaintingTemplateManager:
|
|
| 180 |
feather_radius=10, # Medium: natural scene integration
|
| 181 |
guidance_scale=13.0, # Medium-high: accurate object generation
|
| 182 |
num_inference_steps=10, # Optimized for speed
|
|
|
|
| 183 |
preferred_conditioning="canny", # Edge-based: preserves scene perspective
|
| 184 |
enhance_prompt=True, # Enabled: enriches object details
|
| 185 |
difficulty="medium",
|
|
@@ -218,6 +225,7 @@ class InpaintingTemplateManager:
|
|
| 218 |
feather_radius=12, # Medium: smooth background blending
|
| 219 |
guidance_scale=12.0, # Medium: balanced control and naturalness
|
| 220 |
num_inference_steps=10, # Optimized for speed
|
|
|
|
| 221 |
preferred_conditioning="depth", # Depth: preserves spatial perspective
|
| 222 |
enhance_prompt=False, # Disabled: avoid generating new objects
|
| 223 |
difficulty="medium",
|
|
@@ -367,7 +375,9 @@ class InpaintingTemplateManager:
|
|
| 367 |
"feather_radius": template.feather_radius,
|
| 368 |
"guidance_scale": template.guidance_scale,
|
| 369 |
"num_inference_steps": template.num_inference_steps,
|
| 370 |
-
"
|
|
|
|
|
|
|
| 371 |
}
|
| 372 |
|
| 373 |
def build_prompt(self, key: str, content: str) -> str:
|
|
|
|
| 25 |
guidance_scale: float = 7.5
|
| 26 |
num_inference_steps: int = 25
|
| 27 |
|
| 28 |
+
# Inpainting strength (0.0-1.0)
|
| 29 |
+
# 1.0 = fully repaint masked area, 0.0 = keep original
|
| 30 |
+
strength: float = 1.0
|
| 31 |
+
|
| 32 |
# Conditioning type preference
|
| 33 |
preferred_conditioning: str = "canny" # "canny" or "depth"
|
| 34 |
|
|
|
|
| 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",
|
|
|
|
| 149 |
feather_radius=14, # Medium: natural blending with body
|
| 150 |
guidance_scale=11.5, # Medium-high: accurate clothing generation
|
| 151 |
num_inference_steps=10, # Optimized for speed
|
| 152 |
+
strength=1.0, # Full repaint: completely replace clothing
|
| 153 |
preferred_conditioning="depth", # Depth: preserves fabric folds and body structure
|
| 154 |
enhance_prompt=True, # Enabled: enriches clothing details
|
| 155 |
difficulty="easy",
|
|
|
|
| 186 |
feather_radius=10, # Medium: natural scene integration
|
| 187 |
guidance_scale=13.0, # Medium-high: accurate object generation
|
| 188 |
num_inference_steps=10, # Optimized for speed
|
| 189 |
+
strength=1.0, # Full repaint: completely replace object
|
| 190 |
preferred_conditioning="canny", # Edge-based: preserves scene perspective
|
| 191 |
enhance_prompt=True, # Enabled: enriches object details
|
| 192 |
difficulty="medium",
|
|
|
|
| 225 |
feather_radius=12, # Medium: smooth background blending
|
| 226 |
guidance_scale=12.0, # Medium: balanced control and naturalness
|
| 227 |
num_inference_steps=10, # Optimized for speed
|
| 228 |
+
strength=1.0, # Full repaint: completely remove and fill
|
| 229 |
preferred_conditioning="depth", # Depth: preserves spatial perspective
|
| 230 |
enhance_prompt=False, # Disabled: avoid generating new objects
|
| 231 |
difficulty="medium",
|
|
|
|
| 375 |
"feather_radius": template.feather_radius,
|
| 376 |
"guidance_scale": template.guidance_scale,
|
| 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 |
|
| 383 |
def build_prompt(self, key: str, content: str) -> str:
|