DawnC commited on
Commit
d5fa5c0
·
verified ·
1 Parent(s): 939cd72

Update inpainting_module.py

Browse files
Files changed (1) hide show
  1. inpainting_module.py +21 -6
inpainting_module.py CHANGED
@@ -893,13 +893,28 @@ class InpaintingModule:
893
  self._current_conditioning_type
894
  )
895
 
896
- # Enhance prompt
897
- if progress_callback:
898
- progress_callback("Enhancing prompt...", 25)
 
899
 
900
- enhanced_prompt, negative_prompt = self.enhance_prompt_for_inpainting(
901
- prompt, image, processed_mask
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: