refactor: add info to inpaint_mask_sam_prompt_text, rename variable for dino debugging

This commit is contained in:
Manuel Schmid 2024-06-09 23:09:46 +02:00
parent 57c049858c
commit 09e23f5509
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
3 changed files with 5 additions and 4 deletions

View File

@ -33,11 +33,11 @@ def generate_mask_from_image(image: np.ndarray, mask_model: str, extras: dict, b
if debug_dino:
from PIL import ImageDraw, Image
image_with_boxes = Image.new("RGB", (image.shape[1], image.shape[0]), color="black")
draw = ImageDraw.Draw(image_with_boxes)
debug_dino_image = Image.new("RGB", (image.shape[1], image.shape[0]), color="black")
draw = ImageDraw.Draw(debug_dino_image)
for box in extras['sam_prompt']:
draw.rectangle(box['data'], fill="white")
return np.array(image_with_boxes)
return np.array(debug_dino_image)
return remove(
image,

View File

@ -47,6 +47,7 @@
"Mask generation model": "Mask generation model",
"Cloth category": "Cloth category",
"Segmentation prompt": "Segmentation prompt",
"Use singular whenever possible": "Use singular whenever possible",
"Advanced options": "Advanced options",
"SAM model": "SAM model",
"Quantization": "Quantization",

View File

@ -223,7 +223,7 @@ with shared.gradio_root:
choices=flags.inpaint_mask_cloth_category,
value=modules.config.default_inpaint_mask_cloth_category,
visible=False)
inpaint_mask_sam_prompt_text = gr.Textbox(label='Segmentation prompt', value='', visible=False)
inpaint_mask_sam_prompt_text = gr.Textbox(label='Segmentation prompt', value='', visible=False, info='Use singular whenever possible')
with gr.Accordion("Advanced options", visible=False, open=False) as inpaint_mask_advanced_options:
inpaint_mask_sam_model = gr.Dropdown(label='SAM model', choices=flags.inpaint_mask_sam_model, value=modules.config.default_inpaint_mask_sam_model)
inpaint_mask_sam_quant = gr.Checkbox(label='Quantization', value=False)