Update GUI

This commit is contained in:
bmaltais 2022-12-22 20:18:51 -05:00
parent 89d275dff7
commit 5e3f32f69c
4 changed files with 32 additions and 36 deletions

View File

@ -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')

View File

@ -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',

View File

@ -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,
],
)

View File

@ -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 (