Skip to content

Commit

Permalink
fix issues with dreambooth training invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyongliang committed Feb 3, 2023
1 parent 83446a5 commit 326969a
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions modules/ui.py
Expand Up @@ -673,7 +673,29 @@ def create_ui():
modules.scripts.scripts_txt2img.initialize_scripts(is_img2img=False)

interfaces = []

with gr.Blocks(analytics_enabled=False) as pnginfo_interface:
shared.username_state = gr.Text(value='', visible=False)
with gr.Row().style(equal_height=False):
with gr.Column(variant='panel'):
image = gr.Image(elem_id="pnginfo_image", label="Source", source="upload", interactive=True, type="pil")

with gr.Column(variant='panel'):
html = gr.HTML()
generation_info = gr.Textbox(visible=False)
html2 = gr.HTML()
with gr.Row():
buttons = parameters_copypaste.create_buttons(["txt2img", "img2img", "inpaint", "extras"])
parameters_copypaste.bind_buttons(buttons, image, generation_info)

image.change(
fn=wrap_gradio_call(modules.extras.run_pnginfo),
inputs=[image],
outputs=[html, generation_info, html2],
)

ui_tabs = script_callbacks.ui_tabs_callback()

for ui_tab in ui_tabs:
if ui_tab[2] != 'dreambooth_interface':
interfaces += [ui_tab]
Expand Down Expand Up @@ -793,7 +815,6 @@ def run_settings_single(value, key, username):
return gr.update(value=value), opts.dumpjson()

with gr.Blocks(analytics_enabled=False) as settings_interface:
shared.username_state = gr.Text(value='', visible=False)
dummy_component = gr.Label(visible=False)

settings_submit = gr.Button(value="Apply settings", variant='primary')
Expand Down Expand Up @@ -1376,25 +1397,6 @@ def update_orig(image, state):
inputs=[], outputs=[]
)

with gr.Blocks(analytics_enabled=False) as pnginfo_interface:
with gr.Row().style(equal_height=False):
with gr.Column(variant='panel'):
image = gr.Image(elem_id="pnginfo_image", label="Source", source="upload", interactive=True, type="pil")

with gr.Column(variant='panel'):
html = gr.HTML()
generation_info = gr.Textbox(visible=False)
html2 = gr.HTML()
with gr.Row():
buttons = parameters_copypaste.create_buttons(["txt2img", "img2img", "inpaint", "extras"])
parameters_copypaste.bind_buttons(buttons, image, generation_info)

image.change(
fn=wrap_gradio_call(modules.extras.run_pnginfo),
inputs=[image],
outputs=[html, generation_info, html2],
)

if not cmd_opts.pureui:
with gr.Blocks(analytics_enabled=False) as modelmerger_interface:
with gr.Row().style(equal_height=False):
Expand Down

0 comments on commit 326969a

Please sign in to comment.