From 5e3f32f69c7be73414f6f5c3a1ea27e6573b8d7f Mon Sep 17 00:00:00 2001 From: bmaltais Date: Thu, 22 Dec 2022 20:18:51 -0500 Subject: [PATCH] Update GUI --- dreambooth_gui.py | 17 +++++++++++-- finetune_gui.py | 6 ++--- library/dreambooth_folder_creation_gui.py | 30 +++++++++++------------ library/utilities.py | 15 ------------ 4 files changed, 32 insertions(+), 36 deletions(-) diff --git a/dreambooth_gui.py b/dreambooth_gui.py index 95fa7ee..2ca8119 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -17,6 +17,10 @@ from library.common_gui import ( get_file_path, get_saveasfile_path, ) +from library.dreambooth_folder_creation_gui import ( + gradio_dreambooth_folder_creation_tab, +) +from library.dataset_balancing_gui import gradio_dataset_balancing_tab from library.utilities import utilities_tab from easygui import msgbox @@ -509,7 +513,7 @@ def dreambooth_tab( ): dummy_db_true = gr.Label(value=True, visible=False) dummy_db_false = gr.Label(value=False, visible=False) - gr.Markdown('Enter kohya dreambooth training parameter using this interface.') + gr.Markdown('Train a custom model using kohya dreambooth python code...') with gr.Accordion('Configuration file', open=False): with gr.Row(): button_open_config = gr.Button('Open 📂', elem_id='open_folder') @@ -592,7 +596,7 @@ def dreambooth_tab( ], ) - with gr.Tab('Directories'): + with gr.Tab('Folders'): with gr.Row(): train_data_dir_input = gr.Textbox( label='Image folder', @@ -766,6 +770,15 @@ def dreambooth_tab( prior_loss_weight = gr.Number( label='Prior loss weight', value=1.0 ) + with gr.Tab('Tools'): + gr.Markdown('This section provide Dreambooth tools to help setup your dataset...') + gradio_dreambooth_folder_creation_tab( + train_data_dir_input=train_data_dir_input, + reg_data_dir_input=reg_data_dir_input, + output_dir_input=output_dir_input, + logging_dir_input=logging_dir_input, + ) + gradio_dataset_balancing_tab() button_run = gr.Button('Train model') diff --git a/finetune_gui.py b/finetune_gui.py index 4b3be04..55b8f66 100644 --- a/finetune_gui.py +++ b/finetune_gui.py @@ -403,9 +403,9 @@ def finetune_tab(): dummy_ft_true = gr.Label(value=True, visible=False) dummy_ft_false = gr.Label(value=False, visible=False) gr.Markdown( - 'Enter kohya finetune training parameter using this interface.' + 'Train a custom model using kohya finetune python code...' ) - with gr.Accordion('Configuration File Load/Save', open=False): + with gr.Accordion('Configuration file', open=False): with gr.Row(): button_open_config = gr.Button( f'Open {folder_symbol}', elem_id='open_folder' @@ -486,7 +486,7 @@ def finetune_tab(): v_parameterization_input, ], ) - with gr.Tab('Directories'): + with gr.Tab('Folders'): with gr.Row(): train_dir_input = gr.Textbox( label='Training config folder', diff --git a/library/dreambooth_folder_creation_gui.py b/library/dreambooth_folder_creation_gui.py index 0510cb5..d8d6431 100644 --- a/library/dreambooth_folder_creation_gui.py +++ b/library/dreambooth_folder_creation_gui.py @@ -5,7 +5,7 @@ import shutil import os -def copy_info_to_Directories_tab(training_folder): +def copy_info_to_Folders_tab(training_folder): img_folder = os.path.join(training_folder, 'img') if os.path.exists(os.path.join(training_folder, 'reg')): reg_folder = os.path.join(training_folder, 'reg') @@ -114,7 +114,6 @@ def gradio_dreambooth_folder_creation_tab( reg_data_dir_input=gr.Textbox(), output_dir_input=gr.Textbox(), logging_dir_input=gr.Textbox(), - enable_copy_info_button=bool(False), ): with gr.Tab('Dreambooth folder preparation'): gr.Markdown( @@ -192,17 +191,16 @@ def gradio_dreambooth_folder_creation_tab( util_training_dir_output, ], ) - if enable_copy_info_button: - button_copy_info_to_Directories_tab = gr.Button( - 'Copy info to Directories Tab' - ) - button_copy_info_to_Directories_tab.click( - copy_info_to_Directories_tab, - inputs=[util_training_dir_output], - outputs=[ - train_data_dir_input, - reg_data_dir_input, - output_dir_input, - logging_dir_input, - ], - ) + button_copy_info_to_Folders_tab = gr.Button( + 'Copy info to Folders Tab' + ) + button_copy_info_to_Folders_tab.click( + copy_info_to_Folders_tab, + inputs=[util_training_dir_output], + outputs=[ + train_data_dir_input, + reg_data_dir_input, + output_dir_input, + logging_dir_input, + ], + ) diff --git a/library/utilities.py b/library/utilities.py index c934399..17795bc 100644 --- a/library/utilities.py +++ b/library/utilities.py @@ -6,14 +6,10 @@ import gradio as gr import os import argparse -from library.dreambooth_folder_creation_gui import ( - gradio_dreambooth_folder_creation_tab, -) from library.basic_caption_gui import gradio_basic_caption_gui_tab from library.convert_model_gui import gradio_convert_model_tab from library.blip_caption_gui import gradio_blip_caption_gui_tab from library.wd14_caption_gui import gradio_wd14_caption_gui_tab -from library.dataset_balancing_gui import gradio_dataset_balancing_tab def utilities_tab( @@ -28,17 +24,6 @@ def utilities_tab( gradio_basic_caption_gui_tab() gradio_blip_caption_gui_tab() gradio_wd14_caption_gui_tab() - if enable_dreambooth_tab: - with gr.Tab('Dreambooth'): - gr.Markdown('This section provide Dreambooth specific tools.') - gradio_dreambooth_folder_creation_tab( - train_data_dir_input=train_data_dir_input, - reg_data_dir_input=reg_data_dir_input, - output_dir_input=output_dir_input, - logging_dir_input=logging_dir_input, - enable_copy_info_button=enable_copy_info_button, - ) - gradio_dataset_balancing_tab() gradio_convert_model_tab() return (