MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / to_image

Function to_image

gradio_app.py:47–52  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

45
46
47def to_image(tensor):
48 tensor = tensor.squeeze(0).permute(1, 2, 0)
49 arr = tensor.detach().cpu().numpy()
50 arr = (arr - arr.min()) / (arr.max() - arr.min())
51 arr = arr * 255
52 return arr.astype('uint8')
53
54
55def add_points_to_image(image, points, size=5):

Callers 2

on_image_changeFunction · 0.70
on_select_mask_tabFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected