Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_module.py
Browse files- inpainting_module.py +21 -6
inpainting_module.py
CHANGED
|
@@ -893,13 +893,28 @@ class InpaintingModule:
|
|
| 893 |
self._current_conditioning_type
|
| 894 |
)
|
| 895 |
|
| 896 |
-
#
|
| 897 |
-
if
|
| 898 |
-
|
|
|
|
| 899 |
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 903 |
|
| 904 |
# Setup generator for reproducibility
|
| 905 |
if seed is None:
|
|
|
|
| 893 |
self._current_conditioning_type
|
| 894 |
)
|
| 895 |
|
| 896 |
+
# Conditional prompt enhancement based on template
|
| 897 |
+
# Check if we should enhance the prompt or use it directly
|
| 898 |
+
template_key = kwargs.get('template_key', None)
|
| 899 |
+
should_enhance = True # Default: enhance
|
| 900 |
|
| 901 |
+
if template_key and hasattr(self, 'template_manager'):
|
| 902 |
+
template = self.template_manager.get_template(template_key)
|
| 903 |
+
if template and hasattr(template, 'enhance_prompt'):
|
| 904 |
+
should_enhance = template.enhance_prompt
|
| 905 |
+
|
| 906 |
+
if should_enhance:
|
| 907 |
+
if progress_callback:
|
| 908 |
+
progress_callback("Enhancing prompt...", 25)
|
| 909 |
+
enhanced_prompt, negative_prompt = self.enhance_prompt_for_inpainting(
|
| 910 |
+
prompt, image, processed_mask
|
| 911 |
+
)
|
| 912 |
+
logger.info(f"Prompt enhanced with OpenCLIP context")
|
| 913 |
+
else:
|
| 914 |
+
# Use prompt directly without enhancement
|
| 915 |
+
enhanced_prompt = prompt
|
| 916 |
+
negative_prompt = self._get_inpainting_negative_prompt()
|
| 917 |
+
logger.info("Prompt enhancement disabled for this template")
|
| 918 |
|
| 919 |
# Setup generator for reproducibility
|
| 920 |
if seed is None:
|