mirror of
https://github.com/brycedrennan/imaginAIry
synced 2024-11-05 12:00:15 +00:00
feature: face-fidelity is now configurable
remove face-fixing from upscaled version
This commit is contained in:
parent
9fe3cf79c2
commit
48117bbcb1
@ -330,13 +330,10 @@ def imagine(
|
|||||||
|
|
||||||
if prompt.fix_faces:
|
if prompt.fix_faces:
|
||||||
logger.info(" Fixing 😊 's in 🖼 using CodeFormer...")
|
logger.info(" Fixing 😊 's in 🖼 using CodeFormer...")
|
||||||
img = enhance_faces(img, fidelity=0.2)
|
img = enhance_faces(img, fidelity=prompt.fix_faces_fidelity)
|
||||||
if prompt.upscale:
|
if prompt.upscale:
|
||||||
logger.info(" Upscaling 🖼 using real-ESRGAN...")
|
logger.info(" Upscaling 🖼 using real-ESRGAN...")
|
||||||
upscaled_img = upscale_image(img)
|
upscaled_img = upscale_image(img)
|
||||||
if prompt.fix_faces:
|
|
||||||
logger.info(" Fixing 😊 's in big 🖼 using CodeFormer...")
|
|
||||||
upscaled_img = enhance_faces(upscaled_img, fidelity=0.8)
|
|
||||||
|
|
||||||
# put the newly generated patch back into the original, full size image
|
# put the newly generated patch back into the original, full size image
|
||||||
if (
|
if (
|
||||||
|
@ -99,6 +99,11 @@ def configure_logging(level="INFO"):
|
|||||||
)
|
)
|
||||||
@click.option("--upscale", is_flag=True)
|
@click.option("--upscale", is_flag=True)
|
||||||
@click.option("--fix-faces", is_flag=True)
|
@click.option("--fix-faces", is_flag=True)
|
||||||
|
@click.option(
|
||||||
|
"--fix-faces-fidelity",
|
||||||
|
default=None,
|
||||||
|
help="How faithful to the original should face enhancement be. 1 = best fidelity, 0 = best looking face",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--sampler-type",
|
"--sampler-type",
|
||||||
default="plms",
|
default="plms",
|
||||||
@ -183,6 +188,7 @@ def imagine_cmd(
|
|||||||
seed,
|
seed,
|
||||||
upscale,
|
upscale,
|
||||||
fix_faces,
|
fix_faces,
|
||||||
|
fix_faces_fidelity,
|
||||||
sampler_type,
|
sampler_type,
|
||||||
ddim_eta,
|
ddim_eta,
|
||||||
log_level,
|
log_level,
|
||||||
@ -214,7 +220,8 @@ def imagine_cmd(
|
|||||||
|
|
||||||
if mask_image and mask_image.startswith("http"):
|
if mask_image and mask_image.startswith("http"):
|
||||||
mask_image = LazyLoadingImage(url=mask_image)
|
mask_image = LazyLoadingImage(url=mask_image)
|
||||||
|
if fix_faces_fidelity is not None:
|
||||||
|
fix_faces_fidelity = float(fix_faces_fidelity)
|
||||||
prompts = []
|
prompts = []
|
||||||
load_model()
|
load_model()
|
||||||
for _ in range(repeats):
|
for _ in range(repeats):
|
||||||
@ -235,6 +242,7 @@ def imagine_cmd(
|
|||||||
mask_modify_original=mask_modify_original,
|
mask_modify_original=mask_modify_original,
|
||||||
upscale=upscale,
|
upscale=upscale,
|
||||||
fix_faces=fix_faces,
|
fix_faces=fix_faces,
|
||||||
|
fix_faces_fidelity=fix_faces_fidelity,
|
||||||
tile_mode=tile,
|
tile_mode=tile,
|
||||||
)
|
)
|
||||||
prompts.append(prompt)
|
prompts.append(prompt)
|
||||||
|
@ -102,6 +102,7 @@ class ImaginePrompt:
|
|||||||
width=512,
|
width=512,
|
||||||
upscale=False,
|
upscale=False,
|
||||||
fix_faces=False,
|
fix_faces=False,
|
||||||
|
fix_faces_fidelity=0.5,
|
||||||
sampler_type="PLMS",
|
sampler_type="PLMS",
|
||||||
conditioning=None,
|
conditioning=None,
|
||||||
tile_mode=False,
|
tile_mode=False,
|
||||||
@ -130,6 +131,7 @@ class ImaginePrompt:
|
|||||||
self.width = width
|
self.width = width
|
||||||
self.upscale = upscale
|
self.upscale = upscale
|
||||||
self.fix_faces = fix_faces
|
self.fix_faces = fix_faces
|
||||||
|
self.fix_faces_fidelity = fix_faces_fidelity
|
||||||
self.sampler_type = sampler_type
|
self.sampler_type = sampler_type
|
||||||
self.conditioning = conditioning
|
self.conditioning = conditioning
|
||||||
self.mask_prompt = mask_prompt
|
self.mask_prompt = mask_prompt
|
||||||
|
Loading…
Reference in New Issue
Block a user