(self, x)
| 17 | **kwargs) |
| 18 | |
| 19 | def preprocess(self, x): |
| 20 | if x is None: |
| 21 | return x |
| 22 | if self.tool == "sketch" and self.source in ["upload", "webcam" |
| 23 | ] and type(x) != dict: |
| 24 | decode_image = gr.processing_utils.decode_base64_to_image(x) |
| 25 | width, height = decode_image.size |
| 26 | mask = np.ones((height, width, 4), dtype=np.uint8) |
| 27 | mask[..., -1] = 255 |
| 28 | mask = self.postprocess(mask) |
| 29 | x = {'image': x, 'mask': mask} |
| 30 | return super().preprocess(x) |
| 31 | |
| 32 | |
| 33 | def get_valid_mask(mask: np.ndarray): |
nothing calls this directly
no test coverage detected