Commit
·
5bb43dd
1
Parent(s):
c74e109
28. Sept. 2024, 17:00
Browse files
app.py
CHANGED
@@ -337,22 +337,24 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
|
|
337 |
high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
|
338 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
339 |
|
340 |
-
def set_inputs(
|
341 |
-
global input_options
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
run_btn_lineart = gr.Button("Run", visible=False)
|
347 |
run_btn_canny = gr.Button("Run", visible=False)
|
348 |
|
349 |
all_run_btns = [run_btn_lineart, run_btn_canny]
|
350 |
|
351 |
-
tab_lineart.select(
|
352 |
-
fn=set_inputs("lineart", all_run_btns),
|
353 |
-
inputs=None,
|
354 |
-
outputs=all_run_btns,
|
355 |
-
)
|
356 |
|
357 |
with gr.Column(scale=2):
|
358 |
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")
|
|
|
337 |
high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
|
338 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
339 |
|
340 |
+
def set_inputs(tab, all_run_btns):
|
341 |
+
# global input_options
|
342 |
+
|
343 |
+
lineart_btn = all_run_btns[0]
|
344 |
+
canny_btn = all_run_btns[1]
|
345 |
+
|
346 |
+
lineart_btn_visible = True if tab == "tab_lineart" else False
|
347 |
+
canny_btn_visible = True if tab == "tab_canny" else False
|
348 |
+
{"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}
|
349 |
+
|
350 |
+
return all_run_btns
|
351 |
|
352 |
run_btn_lineart = gr.Button("Run", visible=False)
|
353 |
run_btn_canny = gr.Button("Run", visible=False)
|
354 |
|
355 |
all_run_btns = [run_btn_lineart, run_btn_canny]
|
356 |
|
357 |
+
tab_lineart.select(set_inputs("tab_lineart"), None, all_run_btns)
|
|
|
|
|
|
|
|
|
358 |
|
359 |
with gr.Column(scale=2):
|
360 |
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")
|