MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / construct_edit_image

Method construct_edit_image

demo_lora.py:103–121  ·  view source on GitHub ↗
(self, edit_image, edit_mask)

Source from the content-addressed store, hash-verified

101 ]
102
103 def construct_edit_image(self, edit_image, edit_mask):
104 if edit_image is not None and edit_mask is not None:
105 edit_image_rgb = pillow_convert(edit_image, "RGB")
106 edit_image_rgba = pillow_convert(edit_image, "RGBA")
107 edit_mask = pillow_convert(edit_mask, "L")
108
109 arr1 = np.array(edit_image_rgb)
110 arr2 = np.array(edit_mask)[:, :, np.newaxis]
111 result_array = np.concatenate((arr1, arr2), axis=2)
112 layer = Image.fromarray(result_array)
113
114 ret_data = {
115 "background": edit_image_rgba,
116 "composite": edit_image_rgba,
117 "layers": [layer]
118 }
119 return ret_data
120 else:
121 return None
122
123
124

Callers 1

run_exampleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected