MCPcopy Create free account
hub / github.com/XingangPan/DragGAN / preprocess

Method preprocess

gradio_utils/utils.py:19–30  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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
33def get_valid_mask(mask: np.ndarray):

Callers

nothing calls this directly

Calls 1

postprocessMethod · 0.80

Tested by

no test coverage detected