mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
Merge branch 'feature/add-inpaint-mask-generation'
# Conflicts: # language/en.json # modules/config.py
This commit is contained in:
+10
-10
@@ -36,6 +36,15 @@
|
|||||||
"Top": "Top",
|
"Top": "Top",
|
||||||
"Bottom": "Bottom",
|
"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)",
|
"* \"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",
|
"Setting": "Setting",
|
||||||
"Style": "Style",
|
"Style": "Style",
|
||||||
"Performance": "Performance",
|
"Performance": "Performance",
|
||||||
@@ -376,15 +385,6 @@
|
|||||||
"Fooocus Enhance": "Fooocus Enhance",
|
"Fooocus Enhance": "Fooocus Enhance",
|
||||||
"Fooocus Cinematic": "Fooocus Cinematic",
|
"Fooocus Cinematic": "Fooocus Cinematic",
|
||||||
"Fooocus Sharp": "Fooocus Sharp",
|
"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",
|
"Drag any image generated by Fooocus here": "Drag any image generated by Fooocus here",
|
||||||
"Metadata": "Metadata",
|
"Metadata": "Metadata",
|
||||||
"Apply Metadata": "Apply 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.",
|
"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)",
|
"fooocus (json)": "fooocus (json)",
|
||||||
"a1111 (plain text)": "a1111 (plain text)"
|
"a1111 (plain text)": "a1111 (plain text)"
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@ import fooocus_version
|
|||||||
from build_launcher import build_launcher
|
from build_launcher import build_launcher
|
||||||
from modules.launch_util import is_installed, run, python, run_pip, requirements_met
|
from modules.launch_util import is_installed, run, python, run_pip, requirements_met
|
||||||
from modules.model_loader import load_file_from_url
|
from modules.model_loader import load_file_from_url
|
||||||
|
from modules import config
|
||||||
|
|
||||||
REINSTALL_ALL = False
|
REINSTALL_ALL = False
|
||||||
TRY_INSTALL_XFORMERS = False
|
TRY_INSTALL_XFORMERS = False
|
||||||
|
|||||||
+11
-7
@@ -354,13 +354,17 @@ def worker():
|
|||||||
inpaint_mask = inpaint_input_image['mask'][:, :, 0]
|
inpaint_mask = inpaint_input_image['mask'][:, :, 0]
|
||||||
|
|
||||||
if inpaint_mask_upload_checkbox:
|
if inpaint_mask_upload_checkbox:
|
||||||
if isinstance(inpaint_mask_image_upload, np.ndarray):
|
if isinstance(inpaint_mask_image_upload, dict):
|
||||||
if inpaint_mask_image_upload.ndim == 3:
|
if (isinstance(inpaint_mask_image_upload['image'], np.ndarray)
|
||||||
H, W, C = inpaint_image.shape
|
and isinstance(inpaint_mask_image_upload['mask'], np.ndarray)
|
||||||
inpaint_mask_image_upload = resample_image(inpaint_mask_image_upload, width=W, height=H)
|
and inpaint_mask_image_upload['image'].ndim == 3):
|
||||||
inpaint_mask_image_upload = np.mean(inpaint_mask_image_upload, axis=2)
|
inpaint_mask_image_upload = np.maximum(inpaint_mask_image_upload['image'], inpaint_mask_image_upload['mask'])
|
||||||
inpaint_mask_image_upload = (inpaint_mask_image_upload > 127).astype(np.uint8) * 255
|
if isinstance(inpaint_mask_image_upload, np.ndarray) and inpaint_mask_image_upload.ndim == 3:
|
||||||
inpaint_mask = np.maximum(inpaint_mask, inpaint_mask_image_upload)
|
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:
|
if int(inpaint_erode_or_dilate) != 0:
|
||||||
inpaint_mask = erode_or_dilate(inpaint_mask, inpaint_erode_or_dilate)
|
inpaint_mask = erode_or_dilate(inpaint_mask, inpaint_erode_or_dilate)
|
||||||
|
|||||||
@@ -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)
|
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:
|
with gr.Column(visible=False) as inpaint_mask_generation_col:
|
||||||
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy',
|
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", mask_opacity=1)
|
||||||
height=500)
|
|
||||||
inpaint_mask_model = gr.Dropdown(label='Mask generation model',
|
inpaint_mask_model = gr.Dropdown(label='Mask generation model',
|
||||||
choices=flags.inpaint_mask_models,
|
choices=flags.inpaint_mask_models,
|
||||||
value=modules.config.default_inpaint_mask_model)
|
value=modules.config.default_inpaint_mask_model)
|
||||||
|
|||||||
Reference in New Issue
Block a user