Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tuofeilunhifi committed Apr 12, 2023
1 parent 3901bc4 commit f9d5059
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions gradio_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ def run_grounded_sam(image_path, text_prompt, task_type, inpaint_prompt, box_thr
if inpaint_mode == 'merge':
masks = torch.sum(masks, dim=0).unsqueeze(0)
masks = torch.where(masks > 0, True, False)
else:
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask_pil = Image.fromarray(mask)

pipe = StableDiffusionInpaintPipeline.from_pretrained(
Expand Down
3 changes: 1 addition & 2 deletions grounded_sam_inpainting_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ def show_box(box, ax, label):
if inpaint_mode == 'merge':
masks = torch.sum(masks, dim=0).unsqueeze(0)
masks = torch.where(masks > 0, True, False)
else:
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask_pil = Image.fromarray(mask)
image_pil = Image.fromarray(image)

Expand Down
3 changes: 1 addition & 2 deletions grounded_sam_whisper_inpainting_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def filter_prompts_with_chatgpt(caption, max_tokens=100, model="gpt-3.5-turbo"):
if inpaint_mode == 'merge':
masks = torch.sum(masks, dim=0).unsqueeze(0)
masks = torch.where(masks > 0, True, False)
else:
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask = masks[0][0].cpu().numpy() # simply choose the first mask, which will be refine in the future release
mask_pil = Image.fromarray(mask)
image_pil = Image.fromarray(image)

Expand Down

0 comments on commit f9d5059

Please sign in to comment.