| 124 | |
| 125 | |
| 126 | def create_ui(self): |
| 127 | with gr.Row(equal_height=True, visible=True): |
| 128 | with gr.Column(scale=2): |
| 129 | self.gallery_image = gr.Image( |
| 130 | height=600, |
| 131 | interactive=False, |
| 132 | type='pil', |
| 133 | elem_id='Reference_image' |
| 134 | ) |
| 135 | with gr.Column(scale=1, visible=True) as self.edit_preprocess_panel: |
| 136 | with gr.Row(): |
| 137 | with gr.Accordion(label='Related Input Image', open=False): |
| 138 | self.edit_preprocess_preview = gr.Image( |
| 139 | height=600, |
| 140 | interactive=False, |
| 141 | type='pil', |
| 142 | elem_id='preprocess_image' |
| 143 | ) |
| 144 | |
| 145 | self.edit_preprocess_mask_preview = gr.Image( |
| 146 | height=600, |
| 147 | interactive=False, |
| 148 | type='pil', |
| 149 | elem_id='preprocess_image_mask' |
| 150 | ) |
| 151 | with gr.Row(): |
| 152 | instruction = """ |
| 153 | **Instruction**: |
| 154 | 1. Please choose the Task Type based on the scenario of the generation task. We provide three types of generation capabilities: Portrait ID Preservation Generation(portrait), |
| 155 | Object ID Preservation Generation(subject), and Local Controlled Generation(local editing), which can be selected from the task dropdown menu. |
| 156 | 2. When uploading images in the Reference Image section, the generated image will reference the ID information of that image. Please ensure that the ID information is clear. |
| 157 | In the Edit Image section, the uploaded image will maintain its structural and content information, and you must draw a mask area to specify the region to be regenerated. |
| 158 | 3. When the task type is local editing, there are various editing types to choose from. Users can select different information preserving dimensions, such as edge information, |
| 159 | color information, and more. The pre-processing information can be viewed in the 'related input image' tab. |
| 160 | """ |
| 161 | self.instruction = gr.Markdown(value=instruction) |
| 162 | with gr.Row(): |
| 163 | self.model_name_dd = gr.Dropdown( |
| 164 | choices=self.model_choices, |
| 165 | value=self.default_model_name, |
| 166 | label='Model Version') |
| 167 | self.task_type = gr.Dropdown(choices=self.task_model_list, |
| 168 | interactive=True, |
| 169 | value=self.task_model_list[0], |
| 170 | label='Task Type') |
| 171 | self.edit_type = gr.Dropdown(choices=self.edit_type_list, |
| 172 | interactive=True, |
| 173 | value=self.edit_type_list[0], |
| 174 | label='Edit Type') |
| 175 | with gr.Row(): |
| 176 | self.generation_info_preview = gr.Markdown( |
| 177 | label='System Log.', |
| 178 | show_label=True) |
| 179 | with gr.Row(variant='panel', |
| 180 | equal_height=True, |
| 181 | show_progress=False): |
| 182 | with gr.Column(scale=10, min_width=500): |
| 183 | self.text = gr.Textbox( |