import gradio as gr import os import argparse from dreambooth_gui import dreambooth_tab from finetune_gui import finetune_tab from textual_inversion_gui import ti_tab from library.utilities import utilities_tab from lora_gui import lora_tab from library.class_lora_tab import LoRATools import os from library.custom_logging import setup_logging from localization_ext import add_javascript # Set up logging log = setup_logging() def UI(**kwargs): add_javascript(kwargs.get('language')) css = '' headless = kwargs.get('headless', False) log.info(f'headless: {headless}') if os.path.exists('./style.css'): with open(os.path.join('./style.css'), 'r', encoding='utf8') as file: log.info('Load CSS...') css += file.read() + '\n' if os.path.exists('./.release'): with open(os.path.join('./.release'), 'r', encoding='utf8') as file: release = file.read() if os.path.exists('./README.md'): with open(os.path.join('./README.md'), 'r', encoding='utf8') as file: README = file.read() interface = gr.Blocks( css=css, title=f'Kohya_ss GUI {release}', theme=gr.themes.Default() ) with interface: with gr.Tab('Dreambooth'): ( train_data_dir_input, reg_data_dir_input, output_dir_input, logging_dir_input, ) = dreambooth_tab(headless=headless) with gr.Tab('LoRA'): lora_tab(headless=headless) with gr.Tab('Textual Inversion'): ti_tab(headless=headless) with gr.Tab('Finetuning'): finetune_tab(headless=headless) with gr.Tab('Utilities'): utilities_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=True, headless=headless, ) with gr.Tab('LoRA'): _ = LoRATools(headless=headless) with gr.Tab('About'): gr.Markdown(f'kohya_ss GUI release {release}') with gr.Tab('README'): gr.Markdown(README) htmlStr = f"""