MCPcopy Index your code
hub / github.com/chenfei-wu/TaskMatrix / pad_edge

Method pad_edge

visual_chatgpt.py:1365–1375  ·  view source on GitHub ↗
(self,mask,padding)

Source from the content-addressed store, hash-verified

1363 self.inpaint = Inpainting
1364
1365 def pad_edge(self,mask,padding):
1366 #mask Tensor [H,W]
1367 mask = mask.numpy()
1368 true_indices = np.argwhere(mask)
1369 mask_array = np.zeros_like(mask, dtype=bool)
1370 for idx in true_indices:
1371 padded_slice = tuple(slice(max(0, i - padding), i + padding + 1) for i in idx)
1372 mask_array[padded_slice] = True
1373 new_mask = (mask_array * 255).astype(np.uint8)
1374 #new_mask
1375 return new_mask
1376
1377 @prompts(name="Remove Something From The Photo",
1378 description="useful when you want to remove and object or something from the photo "

Callers 1

inference_replace_samMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected