From 9b2ff7a8f8965314155e92c5b8267b8fe5a969b6 Mon Sep 17 00:00:00 2001 From: bmaltais Date: Sat, 17 Dec 2022 09:51:30 -0500 Subject: [PATCH] Fix logic issue for reg images folder creation --- dreambooth_gui.py | 17 +++++++++++++++++ dreambooth_gui/common_gui.py | 16 ++++++++-------- dreambooth_gui/dreambooth_folder_creation.py | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/dreambooth_gui.py b/dreambooth_gui.py index 3682f14..b148c3a 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -21,6 +21,11 @@ from dreambooth_gui.common_gui import ( ) from easygui import filesavebox, msgbox +folder_symbol = '\U0001f4c2' # 📂 +refresh_symbol = '\U0001f504' # 🔄 +save_style_symbol = '\U0001f4be' # 💾 +document_symbol = '\U0001F4C4' # 📄 + def save_configuration( save_as, @@ -505,6 +510,18 @@ with interface: label='Pretrained model name or path', placeholder='enter the path to custom model or name of pretrained model', ) + pretrained_model_name_or_path_fille = gr.Button( + document_symbol, elem_id='open_folder_small' + ) + pretrained_model_name_or_path_fille.click( + get_file_path, inputs=[pretrained_model_name_or_path_input], outputs=pretrained_model_name_or_path_input + ) + pretrained_model_name_or_path_folder = gr.Button( + folder_symbol, elem_id='open_folder_small' + ) + pretrained_model_name_or_path_folder.click( + get_folder_path, outputs=pretrained_model_name_or_path_input + ) model_list = gr.Dropdown( label='(Optional) Model Quick Pick', choices=[ diff --git a/dreambooth_gui/common_gui.py b/dreambooth_gui/common_gui.py index d26ac36..9c90417 100644 --- a/dreambooth_gui/common_gui.py +++ b/dreambooth_gui/common_gui.py @@ -7,16 +7,16 @@ def get_folder_path(): return folder_path +def get_file_path(file_path): + file_path = fileopenbox( + 'Select the config file to load', default=file_path, filetypes='*.json', + ) + + return file_path + + def remove_doublequote(file_path): if file_path != None: file_path = file_path.replace('"', '') return file_path - - -def get_file_path(file_path): - file_path = fileopenbox( - 'Select the config file to load', default=file_path, filetypes='*.json' - ) - - return file_path diff --git a/dreambooth_gui/dreambooth_folder_creation.py b/dreambooth_gui/dreambooth_folder_creation.py index d97d123..984c0d4 100644 --- a/dreambooth_gui/dreambooth_folder_creation.py +++ b/dreambooth_gui/dreambooth_folder_creation.py @@ -70,7 +70,7 @@ def dreambooth_folder_preparation( # Create the regularization_dir path if ( - not (util_class_prompt_input == '') + util_class_prompt_input == '' or not util_regularization_images_repeat_input > 0 ): print(