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

Function edit_preprocess

inference/utils.py:13–22  ·  view source on GitHub ↗
(processor, device, edit_image, edit_mask)

Source from the content-addressed store, hash-verified

11
12
13def edit_preprocess(processor, device, edit_image, edit_mask):
14 if edit_image is None or processor is None:
15 return edit_image
16 processor = Config(cfg_dict=processor, load=False)
17 processor = ANNOTATORS.build(processor).to(device)
18 new_edit_image = processor(np.asarray(edit_image))
19 processor = processor.to("cpu")
20 del processor
21 new_edit_image = Image.fromarray(new_edit_image)
22 return Image.composite(new_edit_image, edit_image, edit_mask)
23
24class ACEPlusImageProcessor():
25 def __init__(self, max_aspect_ratio=4, d=16, max_seq_len=2048):

Callers 4

run_chatMethod · 0.90
run_exampleMethod · 0.90
run_chatMethod · 0.90
run_exampleMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected