Merge branch 'feature/add-inpaint-mask-generation'
# Conflicts: # language/en.json # modules/config.py
This commit is contained in:
commit
8e999764a8
|
|
@ -36,6 +36,15 @@
|
|||
"Top": "Top",
|
||||
"Bottom": "Bottom",
|
||||
"* \"Inpaint or Outpaint\" is powered by the sampler \"DPMPP Fooocus Seamless 2M SDE Karras Inpaint Sampler\" (beta)": "* \"Inpaint or Outpaint\" is powered by the sampler \"DPMPP Fooocus Seamless 2M SDE Karras Inpaint Sampler\" (beta)",
|
||||
"Mask generation model": "Mask generation model",
|
||||
"Cloth category": "Cloth category",
|
||||
"Segmentation prompt": "Segmentation prompt",
|
||||
"Advanced options": "Advanced options",
|
||||
"SAM model": "SAM model",
|
||||
"Quantization": "Quantization",
|
||||
"Box Threshold": "Box Threshold",
|
||||
"Text Threshold": "Text Threshold",
|
||||
"Generate mask from image": "Generate mask from image",
|
||||
"Setting": "Setting",
|
||||
"Style": "Style",
|
||||
"Performance": "Performance",
|
||||
|
|
@ -376,15 +385,6 @@
|
|||
"Fooocus Enhance": "Fooocus Enhance",
|
||||
"Fooocus Cinematic": "Fooocus Cinematic",
|
||||
"Fooocus Sharp": "Fooocus Sharp",
|
||||
"Mask generation model": "Mask generation model",
|
||||
"Cloth category": "Cloth category",
|
||||
"Segmentation prompt": "Segmentation prompt",
|
||||
"Advanced options": "Advanced options",
|
||||
"SAM model": "SAM model",
|
||||
"Quantization": "Quantization",
|
||||
"Box Threshold": "Box Threshold",
|
||||
"Text Threshold": "Text Threshold",
|
||||
"Generate mask from image": "Generate mask from image"
|
||||
"Drag any image generated by Fooocus here": "Drag any image generated by Fooocus here",
|
||||
"Metadata": "Metadata",
|
||||
"Apply Metadata": "Apply Metadata",
|
||||
|
|
@ -392,4 +392,4 @@
|
|||
"Image Prompt parameters are not included. Use a1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use a1111 for compatibility with Civitai.",
|
||||
"fooocus (json)": "fooocus (json)",
|
||||
"a1111 (plain text)": "a1111 (plain text)"
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ import fooocus_version
|
|||
from build_launcher import build_launcher
|
||||
from modules.launch_util import is_installed, run, python, run_pip, requirements_met
|
||||
from modules.model_loader import load_file_from_url
|
||||
from modules import config
|
||||
|
||||
REINSTALL_ALL = False
|
||||
TRY_INSTALL_XFORMERS = False
|
||||
|
|
|
|||
|
|
@ -354,13 +354,17 @@ def worker():
|
|||
inpaint_mask = inpaint_input_image['mask'][:, :, 0]
|
||||
|
||||
if inpaint_mask_upload_checkbox:
|
||||
if isinstance(inpaint_mask_image_upload, np.ndarray):
|
||||
if inpaint_mask_image_upload.ndim == 3:
|
||||
H, W, C = inpaint_image.shape
|
||||
inpaint_mask_image_upload = resample_image(inpaint_mask_image_upload, width=W, height=H)
|
||||
inpaint_mask_image_upload = np.mean(inpaint_mask_image_upload, axis=2)
|
||||
inpaint_mask_image_upload = (inpaint_mask_image_upload > 127).astype(np.uint8) * 255
|
||||
inpaint_mask = np.maximum(inpaint_mask, inpaint_mask_image_upload)
|
||||
if isinstance(inpaint_mask_image_upload, dict):
|
||||
if (isinstance(inpaint_mask_image_upload['image'], np.ndarray)
|
||||
and isinstance(inpaint_mask_image_upload['mask'], np.ndarray)
|
||||
and inpaint_mask_image_upload['image'].ndim == 3):
|
||||
inpaint_mask_image_upload = np.maximum(inpaint_mask_image_upload['image'], inpaint_mask_image_upload['mask'])
|
||||
if isinstance(inpaint_mask_image_upload, np.ndarray) and inpaint_mask_image_upload.ndim == 3:
|
||||
H, W, C = inpaint_image.shape
|
||||
inpaint_mask_image_upload = resample_image(inpaint_mask_image_upload, width=W, height=H)
|
||||
inpaint_mask_image_upload = np.mean(inpaint_mask_image_upload, axis=2)
|
||||
inpaint_mask_image_upload = (inpaint_mask_image_upload > 127).astype(np.uint8) * 255
|
||||
inpaint_mask = np.maximum(inpaint_mask, inpaint_mask_image_upload)
|
||||
|
||||
if int(inpaint_erode_or_dilate) != 0:
|
||||
inpaint_mask = erode_or_dilate(inpaint_mask, inpaint_erode_or_dilate)
|
||||
|
|
|
|||
3
webui.py
3
webui.py
|
|
@ -211,8 +211,7 @@ with shared.gradio_root:
|
|||
example_inpaint_prompts.click(lambda x: x[0], inputs=example_inpaint_prompts, outputs=inpaint_additional_prompt, show_progress=False, queue=False)
|
||||
|
||||
with gr.Column(visible=False) as inpaint_mask_generation_col:
|
||||
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy',
|
||||
height=500)
|
||||
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", mask_opacity=1)
|
||||
inpaint_mask_model = gr.Dropdown(label='Mask generation model',
|
||||
choices=flags.inpaint_mask_models,
|
||||
value=modules.config.default_inpaint_mask_model)
|
||||
|
|
|
|||
Loading…
Reference in New Issue