@@ -231,9 +231,14 @@ def import_original(original_img, width, height):
231
231
232
232
233
233
def base_model_changed (base_model_id ):
234
- new_choices = get_checkpoints (
235
- os .path .join ("checkpoints" , os .path .basename (str (base_model_id )))
236
- ) + get_checkpoints (model_type = "checkpoints" )
234
+ ckpt_path = Path (
235
+ os .path .join (
236
+ cmd_opts .model_dir , "checkpoints" , os .path .basename (str (base_model_id ))
237
+ )
238
+ )
239
+ ckpt_path .mkdir (parents = True , exist_ok = True )
240
+
241
+ new_choices = get_checkpoints (ckpt_path ) + get_checkpoints (model_type = "checkpoints" )
237
242
238
243
return gr .Dropdown (
239
244
value = new_choices [0 ] if len (new_choices ) > 0 else "None" ,
@@ -581,21 +586,6 @@ def base_model_changed(base_model_id):
581
586
object_fit = "fit" ,
582
587
preview = True ,
583
588
)
584
- with gr .Row ():
585
- std_output = gr .Textbox (
586
- value = f"{ sd_model_info } \n "
587
- f"Images will be saved at "
588
- f"{ get_generated_imgs_path ()} " ,
589
- lines = 2 ,
590
- elem_id = "std_output" ,
591
- show_label = True ,
592
- label = "Log" ,
593
- show_copy_button = True ,
594
- )
595
- sd_element .load (
596
- logger .read_sd_logs , None , std_output , every = 1
597
- )
598
- sd_status = gr .Textbox (visible = False )
599
589
with gr .Row ():
600
590
batch_count = gr .Slider (
601
591
1 ,
@@ -631,19 +621,18 @@ def base_model_changed(base_model_id):
631
621
stop_batch = gr .Button ("Stop" )
632
622
with gr .Tab (label = "Config" , id = 102 ) as sd_tab_config :
633
623
with gr .Column (elem_classes = ["sd-right-panel" ]):
634
- with gr .Row (elem_classes = ["fill" ]):
635
- Path (get_configs_path ()).mkdir (
636
- parents = True , exist_ok = True
637
- )
638
- default_config_file = os .path .join (
639
- get_configs_path (),
640
- "default_sd_config.json" ,
641
- )
642
- write_default_sd_config (default_config_file )
643
- sd_json = gr .JSON (
644
- elem_classes = ["fill" ],
645
- value = view_json_file (default_config_file ),
646
- )
624
+ Path (get_configs_path ()).mkdir (parents = True , exist_ok = True )
625
+ default_config_file = os .path .join (
626
+ get_configs_path (),
627
+ "default_sd_config.json" ,
628
+ )
629
+ write_default_sd_config (default_config_file )
630
+ sd_json = gr .JSON (
631
+ label = "SD Config" ,
632
+ elem_classes = ["fill" ],
633
+ value = view_json_file (default_config_file ),
634
+ render = False ,
635
+ )
647
636
with gr .Row ():
648
637
with gr .Column (scale = 3 ):
649
638
load_sd_config = gr .FileExplorer (
@@ -706,11 +695,30 @@ def base_model_changed(base_model_id):
706
695
inputs = [sd_json , sd_config_name ],
707
696
outputs = [sd_config_name ],
708
697
)
698
+ with gr .Row (elem_classes = ["fill" ]):
699
+ sd_json .render ()
709
700
save_sd_config .click (
710
701
fn = save_sd_cfg ,
711
702
inputs = [sd_json , sd_config_name ],
712
703
outputs = [sd_config_name ],
713
704
)
705
+ with gr .Tab (label = "Log" , id = 103 ) as sd_tab_log :
706
+ with gr .Row ():
707
+ std_output = gr .Textbox (
708
+ value = f"{ sd_model_info } \n "
709
+ f"Images will be saved at "
710
+ f"{ get_generated_imgs_path ()} " ,
711
+ elem_id = "std_output" ,
712
+ show_label = True ,
713
+ label = "Log" ,
714
+ show_copy_button = True ,
715
+ )
716
+ sd_element .load (
717
+ logger .read_sd_logs , None , std_output , every = 1
718
+ )
719
+ sd_status = gr .Textbox (visible = False )
720
+ with gr .Tab (label = "Automation" , id = 104 ) as sd_tab_automation :
721
+ pass
714
722
715
723
pull_kwargs = dict (
716
724
fn = pull_sd_configs ,
0 commit comments