Sebastiankay commited on
Commit
0c832c0
·
1 Parent(s): 352f7e9

28. Sept. 2024, 18:25

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -315,12 +315,11 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
315
 
316
  ## TAB LINEART
317
  with gr.Tab("Lineart") as tab_lineart:
318
- with gr.Row():
319
- gr.Markdown("<p>Check Invert to use with Mochi Diffusion. Inverted image can also be created here for use with ControlNet Scribble.")
320
  with gr.Row():
321
  with gr.Column():
322
  invert_toggle_info = ["Schwarzer Hintergrund, Weiße Linien", "Weißer Hintergrund, Schwarze Linien"]
323
  preprocessor_name = gr.Radio(label="Preprocessor", show_label=False, choices=["Lineart", "Lineart Coarse", "Lineart Anime"], type="value", value="Lineart")
 
324
  invert = gr.Checkbox(label="Farbe invertieren?", info=invert_toggle_info[0], value=True, elem_classes="toggle-btn")
325
  resolution = gr.Slider(label="Auflösung", minimum=256, maximum=1024, value=512, step=64)
326
  invert.change(lambda x: {"info": invert_toggle_info[0] if x else invert_toggle_info[1], "__type__": "update"}, inputs=invert, outputs=invert)
@@ -335,10 +334,10 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
335
  high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
336
  resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
337
 
338
- run_btn_lineart = gr.Button("Run", visible=False)
339
- run_btn_canny = gr.Button("Run", visible=False)
340
 
341
- # all_run_btns = [run_btn_lineart, run_btn_canny]
342
 
343
  def set_inputs(tab):
344
  tab = "tab_lineart" if tab is None else tab
@@ -349,6 +348,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
349
  return {"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}
350
 
351
  tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny])
 
352
 
353
  with gr.Column(scale=2):
354
  gallery = gr.Gallery(label="Generated images", show_label=False, interactive=False, format="png", elem_id="output_gallery", elem_classes="output-gallery", columns=[3], rows=[2], object_fit="contain", height="auto", type="filepath")
 
315
 
316
  ## TAB LINEART
317
  with gr.Tab("Lineart") as tab_lineart:
 
 
318
  with gr.Row():
319
  with gr.Column():
320
  invert_toggle_info = ["Schwarzer Hintergrund, Weiße Linien", "Weißer Hintergrund, Schwarze Linien"]
321
  preprocessor_name = gr.Radio(label="Preprocessor", show_label=False, choices=["Lineart", "Lineart Coarse", "Lineart Anime"], type="value", value="Lineart")
322
+
323
  invert = gr.Checkbox(label="Farbe invertieren?", info=invert_toggle_info[0], value=True, elem_classes="toggle-btn")
324
  resolution = gr.Slider(label="Auflösung", minimum=256, maximum=1024, value=512, step=64)
325
  invert.change(lambda x: {"info": invert_toggle_info[0] if x else invert_toggle_info[1], "__type__": "update"}, inputs=invert, outputs=invert)
 
334
  high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
335
  resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
336
 
337
+ run_btn_lineart = gr.Button("Los", variant="primary", visible=True)
338
+ run_btn_canny = gr.Button("Los", variant="primary", visible=False)
339
 
340
+ all_run_btns = [run_btn_lineart, run_btn_canny]
341
 
342
  def set_inputs(tab):
343
  tab = "tab_lineart" if tab is None else tab
 
348
  return {"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}
349
 
350
  tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny])
351
+ tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny])
352
 
353
  with gr.Column(scale=2):
354
  gallery = gr.Gallery(label="Generated images", show_label=False, interactive=False, format="png", elem_id="output_gallery", elem_classes="output-gallery", columns=[3], rows=[2], object_fit="contain", height="auto", type="filepath")