@@ -589,6 +589,7 @@ def refresh():
589
589
)
590
590
return refresh_button
591
591
592
+
592
593
def create_output_panel (tabname , outdir ):
593
594
def open_folder (f ):
594
595
if not os .path .exists (f ):
@@ -716,6 +717,7 @@ def create_ui(wrap_gradio_gpu_call):
716
717
custom_inputs = modules .scripts .scripts_txt2img .setup_ui (is_img2img = False )
717
718
718
719
txt2img_gallery , generation_info , html_info = create_output_panel ("txt2img" , opts .outdir_txt2img_samples )
720
+ parameters_copypaste .bind_buttons ({"txt2img" : txt2img_paste }, None , txt2img_prompt )
719
721
720
722
connect_reuse_seed (seed , reuse_seed , generation_info , dummy_component , is_subseed = False )
721
723
connect_reuse_seed (subseed , reuse_subseed , generation_info , dummy_component , is_subseed = True )
@@ -784,7 +786,7 @@ def create_ui(wrap_gradio_gpu_call):
784
786
]
785
787
)
786
788
787
- parameters_copypaste . add_paste_fields ( "txt2img" , None , [
789
+ txt2img_paste_fields = [
788
790
(txt2img_prompt , "Prompt" ),
789
791
(txt2img_negative_prompt , "Negative prompt" ),
790
792
(steps , "Steps" ),
@@ -805,7 +807,8 @@ def create_ui(wrap_gradio_gpu_call):
805
807
(firstphase_width , "First pass size-1" ),
806
808
(firstphase_height , "First pass size-2" ),
807
809
* modules .scripts .scripts_txt2img .infotext_fields
808
- ])
810
+ ]
811
+ parameters_copypaste .add_paste_fields ("txt2img" , None , txt2img_paste_fields )
809
812
810
813
txt2img_preview_params = [
811
814
txt2img_prompt ,
@@ -893,6 +896,7 @@ def create_ui(wrap_gradio_gpu_call):
893
896
custom_inputs = modules .scripts .scripts_img2img .setup_ui (is_img2img = True )
894
897
895
898
img2img_gallery , generation_info , html_info = create_output_panel ("img2img" , opts .outdir_img2img_samples )
899
+ parameters_copypaste .bind_buttons ({"img2img" : img2img_paste }, None , img2img_prompt )
896
900
897
901
connect_reuse_seed (seed , reuse_seed , generation_info , dummy_component , is_subseed = False )
898
902
connect_reuse_seed (subseed , reuse_subseed , generation_info , dummy_component , is_subseed = True )
@@ -1038,7 +1042,6 @@ def create_ui(wrap_gradio_gpu_call):
1038
1042
parameters_copypaste .add_paste_fields ("img2img" , init_img , img2img_paste_fields )
1039
1043
parameters_copypaste .add_paste_fields ("inpaint" , init_img_with_mask , img2img_paste_fields )
1040
1044
1041
-
1042
1045
with gr .Blocks (analytics_enabled = False ) as extras_interface :
1043
1046
with gr .Row ().style (equal_height = False ):
1044
1047
with gr .Column (variant = 'panel' ):
@@ -1050,12 +1053,8 @@ def create_ui(wrap_gradio_gpu_call):
1050
1053
image_batch = gr .File (label = "Batch Process" , file_count = "multiple" , interactive = True , type = "file" )
1051
1054
1052
1055
with gr .TabItem ('Batch from Directory' ):
1053
- extras_batch_input_dir = gr .Textbox (label = "Input directory" , ** shared .hide_dirs ,
1054
- placeholder = "A directory on the same machine where the server is running."
1055
- )
1056
- extras_batch_output_dir = gr .Textbox (label = "Output directory" , ** shared .hide_dirs ,
1057
- placeholder = "Leave blank to save images to the default path."
1058
- )
1056
+ extras_batch_input_dir = gr .Textbox (label = "Input directory" , ** shared .hide_dirs , placeholder = "A directory on the same machine where the server is running." )
1057
+ extras_batch_output_dir = gr .Textbox (label = "Output directory" , ** shared .hide_dirs , placeholder = "Leave blank to save images to the default path." )
1059
1058
show_extras_results = gr .Checkbox (label = 'Show result images' , value = True )
1060
1059
1061
1060
with gr .Tabs (elem_id = "extras_resize_mode" ):
@@ -1087,7 +1086,6 @@ def create_ui(wrap_gradio_gpu_call):
1087
1086
1088
1087
submit = gr .Button ('Generate' , elem_id = "extras_generate" , variant = 'primary' )
1089
1088
1090
-
1091
1089
result_images , html_info_x , html_info = create_output_panel ("extras" , opts .outdir_extras_samples )
1092
1090
1093
1091
submit .click (
@@ -1121,7 +1119,6 @@ def create_ui(wrap_gradio_gpu_call):
1121
1119
)
1122
1120
parameters_copypaste .add_paste_fields ("extras" , extras_image , None )
1123
1121
1124
-
1125
1122
extras_image .change (
1126
1123
fn = modules .extras .clear_cache ,
1127
1124
inputs = [], outputs = []
@@ -1587,9 +1584,6 @@ def request_restart():
1587
1584
if column is not None :
1588
1585
column .__exit__ ()
1589
1586
1590
-
1591
-
1592
-
1593
1587
interfaces = [
1594
1588
(txt2img_interface , "txt2img" , "txt2img" ),
1595
1589
(img2img_interface , "img2img" , "img2img" ),
@@ -1599,10 +1593,6 @@ def request_restart():
1599
1593
(train_interface , "Train" , "ti" ),
1600
1594
]
1601
1595
1602
- interfaces += script_callbacks .ui_tabs_callback ()
1603
-
1604
- interfaces += [(settings_interface , "Settings" , "settings" )]
1605
-
1606
1596
css = ""
1607
1597
1608
1598
for cssfile in modules .scripts .list_files_with_name ("style.css" ):
@@ -1619,6 +1609,9 @@ def request_restart():
1619
1609
if not cmd_opts .no_progressbar_hiding :
1620
1610
css += css_hide_progressbar
1621
1611
1612
+ interfaces += script_callbacks .ui_tabs_callback ()
1613
+ interfaces += [(settings_interface , "Settings" , "settings" )]
1614
+
1622
1615
with gr .Blocks (css = css , analytics_enabled = False , title = "Stable Diffusion" ) as demo :
1623
1616
with gr .Row (elem_id = "quicksettings" ):
1624
1617
for i , k , item in quicksettings_list :
@@ -1627,6 +1620,9 @@ def request_restart():
1627
1620
1628
1621
settings_interface .gradio_ref = demo
1629
1622
1623
+ parameters_copypaste .integrate_settings_paste_fields (component_dict )
1624
+ parameters_copypaste .run_bind ()
1625
+
1630
1626
with gr .Tabs (elem_id = "tabs" ) as tabs :
1631
1627
for interface , label , ifid in interfaces :
1632
1628
with gr .TabItem (label , id = ifid , elem_id = 'tab_' + ifid ):
@@ -1681,16 +1677,6 @@ def modelmerger(*args):
1681
1677
]
1682
1678
)
1683
1679
1684
-
1685
- settings_map = {
1686
- 'sd_hypernetwork' : 'Hypernet' ,
1687
- 'sd_hypernetwork_strength' : 'Hypernetwork strength' ,
1688
- 'CLIP_stop_at_last_layers' : 'Clip skip' ,
1689
- 'sd_model_checkpoint' : 'Model hash' ,
1690
- }
1691
-
1692
- parameters_copypaste .run_bind ()
1693
-
1694
1680
ui_config_file = cmd_opts .ui_config_file
1695
1681
ui_settings = {}
1696
1682
settings_count = len (ui_settings )
@@ -1709,7 +1695,7 @@ def loadsave(path, x):
1709
1695
def apply_field (obj , field , condition = None , init_field = None ):
1710
1696
key = path + "/" + field
1711
1697
1712
- if getattr (obj ,'custom_script_source' ,None ) is not None :
1698
+ if getattr (obj , 'custom_script_source' , None ) is not None :
1713
1699
key = 'customscript/' + obj .custom_script_source + '/' + key
1714
1700
1715
1701
if getattr (obj , 'do_not_save_to_config' , False ):
0 commit comments