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

Method __init__

demo_fft.py:54–88  ·  view source on GitHub ↗
(self,
                 infer_dir = "./config/ace_plus_fft.yaml"
                 )

Source from the content-addressed store, hash-verified

52lock = threading.Lock()
53class DemoUI(object):
54 def __init__(self,
55 infer_dir = "./config/ace_plus_fft.yaml"
56 ):
57 self.model_yamls = [infer_dir]
58 self.model_choices = dict()
59 self.default_model_name = ''
60 self.edit_type_dict = {}
61 self.edit_type_list = []
62 self.default_type_list = []
63 for i in self.model_yamls:
64 model_cfg = Config(load=True, cfg_file=i)
65 model_name = model_cfg.VERSION
66 if model_cfg.IS_DEFAULT: self.default_model_name = model_name
67 self.model_choices[model_name] = model_cfg
68 for preprocessor in model_cfg.get("PREPROCESSOR", []):
69 if preprocessor["TYPE"] in self.edit_type_dict:
70 continue
71 self.edit_type_dict[preprocessor["TYPE"]] = preprocessor
72 self.default_type_list.append(preprocessor["TYPE"])
73 print('Models: ', self.model_choices.keys())
74 assert len(self.model_choices) > 0
75 if self.default_model_name == "": self.default_model_name = list(self.model_choices.keys())[0]
76 self.model_name = self.default_model_name
77 pipe_cfg = self.model_choices[self.default_model_name]
78 self.pipe = INFERENCES.build(pipe_cfg)
79 # reformat examples
80 self.all_examples = [
81 [
82 one_example["edit_type"], one_example["instruction"],
83 one_example["input_reference_image"], one_example["input_image"],
84 one_example["input_mask"], one_example["output_h"],
85 one_example["output_w"], one_example["seed"]
86 ]
87 for one_example in fft_examples
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:

Callers

nothing calls this directly

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected