RioShiina commited on
Commit
0db885a
·
verified ·
1 Parent(s): 7139ce5

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. ui/events.py +22 -22
  2. ui/layout.py +2 -2
ui/events.py CHANGED
@@ -421,7 +421,7 @@ def attach_event_handlers(ui_components, demo):
421
 
422
 
423
  for prefix, task_type in [
424
- ("txt2img", "txt2img"), ("img2img", "img2img"), ("inpaint", "inpaint"),
425
  ("outpaint", "outpaint"), ("hires_fix", "hires_fix"),
426
  ]:
427
  if f'add_lora_button_{prefix}' in ui_components:
@@ -473,7 +473,7 @@ def attach_event_handlers(ui_components, demo):
473
  w, h = res_map.get(ratio_key, (1024, 1024))
474
  return w, h
475
 
476
- for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
477
  if f'aspect_ratio_{prefix}' in ui_components:
478
  aspect_ratio_dropdown = ui_components[f'aspect_ratio_{prefix}']
479
  width_component = ui_components[f'width_{prefix}']
@@ -481,25 +481,25 @@ def attach_event_handlers(ui_components, demo):
481
  model_dropdown = ui_components[f'base_model_{prefix}']
482
  aspect_ratio_dropdown.change(fn=on_aspect_ratio_change, inputs=[aspect_ratio_dropdown, model_dropdown], outputs=[width_component, height_component], show_progress=False)
483
 
484
- if 'view_mode_inpaint' in ui_components:
485
- def toggle_inpaint_fullscreen_view(view_mode):
486
- is_fullscreen = (view_mode == "Fullscreen View")
487
- other_elements_visible = not is_fullscreen
488
- editor_height = 800 if is_fullscreen else 272
489
- return {
490
- ui_components['model_and_run_row_inpaint']: gr.update(visible=other_elements_visible),
491
- ui_components['prompts_column_inpaint']: gr.update(visible=other_elements_visible),
492
- ui_components['params_and_gallery_row_inpaint']: gr.update(visible=other_elements_visible),
493
- ui_components['accordion_wrapper_inpaint']: gr.update(visible=other_elements_visible),
494
- ui_components['input_image_dict_inpaint']: gr.update(height=editor_height),
495
- }
496
 
497
- output_components = [
498
- ui_components['model_and_run_row_inpaint'], ui_components['prompts_column_inpaint'],
499
- ui_components['params_and_gallery_row_inpaint'], ui_components['accordion_wrapper_inpaint'],
500
- ui_components['input_image_dict_inpaint']
501
- ]
502
- ui_components['view_mode_inpaint'].change(fn=toggle_inpaint_fullscreen_view, inputs=[ui_components['view_mode_inpaint']], outputs=output_components, show_progress=False)
503
 
504
  def initialize_all_cn_dropdowns():
505
  cn_config = load_controlnet_config()
@@ -521,7 +521,7 @@ def attach_event_handlers(ui_components, demo):
521
  break
522
 
523
  updates = {}
524
- for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
525
  if f'controlnet_types_{prefix}' in ui_components:
526
  for type_dd in ui_components[f'controlnet_types_{prefix}']:
527
  updates[type_dd] = gr.update(choices=all_types, value=default_type)
@@ -552,7 +552,7 @@ def attach_event_handlers(ui_components, demo):
552
  return all_updates
553
 
554
  all_load_outputs = []
555
- for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
556
  if f'controlnet_types_{prefix}' in ui_components:
557
  all_load_outputs.extend(ui_components[f'controlnet_types_{prefix}'])
558
  all_load_outputs.extend(ui_components[f'controlnet_series_{prefix}'])
 
421
 
422
 
423
  for prefix, task_type in [
424
+ ("txt2img", "txt2img"), ("img2img", "img2img"),
425
  ("outpaint", "outpaint"), ("hires_fix", "hires_fix"),
426
  ]:
427
  if f'add_lora_button_{prefix}' in ui_components:
 
473
  w, h = res_map.get(ratio_key, (1024, 1024))
474
  return w, h
475
 
476
+ for prefix in ["txt2img", "img2img", "outpaint", "hires_fix"]:
477
  if f'aspect_ratio_{prefix}' in ui_components:
478
  aspect_ratio_dropdown = ui_components[f'aspect_ratio_{prefix}']
479
  width_component = ui_components[f'width_{prefix}']
 
481
  model_dropdown = ui_components[f'base_model_{prefix}']
482
  aspect_ratio_dropdown.change(fn=on_aspect_ratio_change, inputs=[aspect_ratio_dropdown, model_dropdown], outputs=[width_component, height_component], show_progress=False)
483
 
484
+ # if 'view_mode_inpaint' in ui_components:
485
+ # def toggle_inpaint_fullscreen_view(view_mode):
486
+ # is_fullscreen = (view_mode == "Fullscreen View")
487
+ # other_elements_visible = not is_fullscreen
488
+ # editor_height = 800 if is_fullscreen else 272
489
+ # return {
490
+ # ui_components['model_and_run_row_inpaint']: gr.update(visible=other_elements_visible),
491
+ # ui_components['prompts_column_inpaint']: gr.update(visible=other_elements_visible),
492
+ # ui_components['params_and_gallery_row_inpaint']: gr.update(visible=other_elements_visible),
493
+ # ui_components['accordion_wrapper_inpaint']: gr.update(visible=other_elements_visible),
494
+ # ui_components['input_image_dict_inpaint']: gr.update(height=editor_height),
495
+ # }
496
 
497
+ # output_components = [
498
+ # ui_components['model_and_run_row_inpaint'], ui_components['prompts_column_inpaint'],
499
+ # ui_components['params_and_gallery_row_inpaint'], ui_components['accordion_wrapper_inpaint'],
500
+ # ui_components['input_image_dict_inpaint']
501
+ # ]
502
+ # ui_components['view_mode_inpaint'].change(fn=toggle_inpaint_fullscreen_view, inputs=[ui_components['view_mode_inpaint']], outputs=output_components, show_progress=False)
503
 
504
  def initialize_all_cn_dropdowns():
505
  cn_config = load_controlnet_config()
 
521
  break
522
 
523
  updates = {}
524
+ for prefix in ["txt2img", "img2img", "outpaint", "hires_fix"]:
525
  if f'controlnet_types_{prefix}' in ui_components:
526
  for type_dd in ui_components[f'controlnet_types_{prefix}']:
527
  updates[type_dd] = gr.update(choices=all_types, value=default_type)
 
552
  return all_updates
553
 
554
  all_load_outputs = []
555
+ for prefix in ["txt2img", "img2img", "outpaint", "hires_fix"]:
556
  if f'controlnet_types_{prefix}' in ui_components:
557
  all_load_outputs.extend(ui_components[f'controlnet_types_{prefix}'])
558
  all_load_outputs.extend(ui_components[f'controlnet_series_{prefix}'])
ui/layout.py CHANGED
@@ -41,8 +41,8 @@ def build_ui(event_handler_function):
41
  with gr.TabItem("Img2Img", id=1):
42
  ui_components.update(img2img_ui.create_ui())
43
 
44
- with gr.TabItem("Inpaint", id=2):
45
- ui_components.update(inpaint_ui.create_ui())
46
 
47
  with gr.TabItem("Outpaint", id=3):
48
  ui_components.update(outpaint_ui.create_ui())
 
41
  with gr.TabItem("Img2Img", id=1):
42
  ui_components.update(img2img_ui.create_ui())
43
 
44
+ # with gr.TabItem("Inpaint", id=2):
45
+ # ui_components.update(inpaint_ui.create_ui())
46
 
47
  with gr.TabItem("Outpaint", id=3):
48
  ui_components.update(outpaint_ui.create_ui())