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

Method construct_edit_image

demo_fft.py:90–108  ·  view source on GitHub ↗
(self, edit_image, edit_mask)

Source from the content-addressed store, hash-verified

88 ]
89
90 def construct_edit_image(self, edit_image, edit_mask):
91 if edit_image is not None and edit_mask is not None:
92 edit_image_rgb = pillow_convert(edit_image, "RGB")
93 edit_image_rgba = pillow_convert(edit_image, "RGBA")
94 edit_mask = pillow_convert(edit_mask, "L")
95
96 arr1 = np.array(edit_image_rgb)
97 arr2 = np.array(edit_mask)[:, :, np.newaxis]
98 result_array = np.concatenate((arr1, arr2), axis=2)
99 layer = Image.fromarray(result_array)
100
101 ret_data = {
102 "background": edit_image_rgba,
103 "composite": edit_image_rgba,
104 "layers": [layer]
105 }
106 return ret_data
107 else:
108 return None
109
110 def create_ui(self):
111 with gr.Row(equal_height=True, visible=True):

Callers 1

run_exampleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected