clean code
This commit is contained in:
parent
58b931fdb2
commit
f13bfb9085
@ -390,3 +390,12 @@ class DiffusionInpaintModel(InpaintModel):
|
|||||||
sd_sampler = SDSampler.lcm
|
sd_sampler = SDSampler.lcm
|
||||||
scheduler = get_scheduler(sd_sampler, scheduler_config)
|
scheduler = get_scheduler(sd_sampler, scheduler_config)
|
||||||
self.model.scheduler = scheduler
|
self.model.scheduler = scheduler
|
||||||
|
|
||||||
|
def forward_post_process(self, result, image, mask, config):
|
||||||
|
if config.sd_match_histograms:
|
||||||
|
result = self._match_histograms(result, image[:, :, ::-1], mask)
|
||||||
|
|
||||||
|
if config.sd_mask_blur != 0:
|
||||||
|
k = 2 * config.sd_mask_blur + 1
|
||||||
|
mask = cv2.GaussianBlur(mask, (k, k), 0)
|
||||||
|
return result, image, mask
|
||||||
|
@ -66,15 +66,6 @@ class Kandinsky(DiffusionInpaintModel):
|
|||||||
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def forward_post_process(self, result, image, mask, config):
|
|
||||||
if config.sd_match_histograms:
|
|
||||||
result = self._match_histograms(result, image[:, :, ::-1], mask)
|
|
||||||
|
|
||||||
if config.sd_mask_blur != 0:
|
|
||||||
k = 2 * config.sd_mask_blur + 1
|
|
||||||
mask = cv2.GaussianBlur(mask, (k, k), 0)
|
|
||||||
return result, image, mask
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_downloaded() -> bool:
|
def is_downloaded() -> bool:
|
||||||
# model will be downloaded when app start, and can't switch in frontend settings
|
# model will be downloaded when app start, and can't switch in frontend settings
|
||||||
|
@ -157,15 +157,6 @@ class SD(DiffusionInpaintModel):
|
|||||||
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def forward_post_process(self, result, image, mask, config):
|
|
||||||
if config.sd_match_histograms:
|
|
||||||
result = self._match_histograms(result, image[:, :, ::-1], mask)
|
|
||||||
|
|
||||||
if config.sd_mask_blur != 0:
|
|
||||||
k = 2 * config.sd_mask_blur + 1
|
|
||||||
mask = cv2.GaussianBlur(mask, (k, k), 0)
|
|
||||||
return result, image, mask
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_downloaded() -> bool:
|
def is_downloaded() -> bool:
|
||||||
# model will be downloaded when app start, and can't switch in frontend settings
|
# model will be downloaded when app start, and can't switch in frontend settings
|
||||||
|
@ -85,14 +85,6 @@ class SDXL(DiffusionInpaintModel):
|
|||||||
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def forward_post_process(self, result, image, mask, config):
|
|
||||||
if config.sd_match_histograms:
|
|
||||||
result = self._match_histograms(result, image[:, :, ::-1], mask)
|
|
||||||
|
|
||||||
if config.sd_mask_blur != 0:
|
|
||||||
k = 2 * config.sd_mask_blur + 1
|
|
||||||
mask = cv2.GaussianBlur(mask, (k, k), 0)
|
|
||||||
return result, image, mask
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_downloaded() -> bool:
|
def is_downloaded() -> bool:
|
||||||
|
Loading…
Reference in New Issue
Block a user