Merge pull request #27 from CuteCat1111/feature_release_method_instead_of_change
Release method instead of change for sliders + Update chromatic valuespull/31/head
commit
eb4f32935d
|
|
@ -200,7 +200,7 @@ def add_tab():
|
|||
neon_rst_btn = gr.Button("reset")
|
||||
|
||||
with gr.TabItem('Chromatic', elem_id='haku_Chromatic'):
|
||||
chromatic_slider = gr.Slider(0, 1, 0, label="chromatic")
|
||||
chromatic_slider = gr.Slider(0, 3, 1, label="chromatic")
|
||||
chromatic_blur_checkbox = gr.Checkbox(label="Blur", value=False)
|
||||
chromatic_btn = gr.Button("refresh", variant="primary")
|
||||
|
||||
|
|
@ -248,19 +248,20 @@ def add_tab():
|
|||
all_blend_set += all_alphas+all_mask_blur+all_mask_str+all_mode
|
||||
all_blend_input = all_blend_set + all_layers
|
||||
for component in all_blend_set:
|
||||
component.change(blend.run(layers), all_blend_input, image_out)
|
||||
_release_if_possible(component, blend.run(layers), all_blend_input, image_out)
|
||||
expand_btn.click(blend.run(layers), all_blend_input, image_out)
|
||||
|
||||
#blur
|
||||
all_blur_input = [image_eff, blur_slider]
|
||||
blur_slider.change(blur.run, all_blur_input, outputs=image_out)
|
||||
_release_if_possible(blur_slider, blur.run, all_blur_input, outputs=image_out)
|
||||
blur_btn.click(blur.run, all_blur_input, outputs=image_out)
|
||||
|
||||
#chromatic
|
||||
all_chromatic_input = [image_eff, chromatic_slider, chromatic_blur_checkbox]
|
||||
chromatic_slider.change(chromatic.run, all_chromatic_input, outputs=image_out)
|
||||
chromatic_blur_checkbox.change(chromatic.run, all_chromatic_input, outputs=image_out)
|
||||
chromatic_btn.click(chromatic.run, all_chromatic_input, outputs=image_out)
|
||||
all_chromatic_set = [chromatic_slider, chromatic_blur_checkbox]
|
||||
all_chromatic_input = [image_eff] + all_chromatic_set
|
||||
for component in all_chromatic_set:
|
||||
_release_if_possible(component, chromatic.run, all_chromatic_input, image_out)
|
||||
chromatic_btn.click(chromatic.run, all_chromatic_input, image_out)
|
||||
|
||||
#color
|
||||
all_color_set = [
|
||||
|
|
@ -271,7 +272,7 @@ def add_tab():
|
|||
]
|
||||
all_color_input = [image_eff] + all_color_set
|
||||
for component in all_color_set:
|
||||
component.change(color.run, all_color_input, image_out)
|
||||
_release_if_possible(component, color.run, all_color_input, image_out)
|
||||
color_btn.click(color.run, all_color_input, image_out)
|
||||
color_rst_btn.click(lambda:[0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0], None, all_color_set)
|
||||
|
||||
|
|
@ -281,7 +282,7 @@ def add_tab():
|
|||
all_curve_input = [image_eff] + all_curve_set
|
||||
for index, components in enumerate(all_points):
|
||||
for component in components:
|
||||
component.change(curve.curve_img, components, all_curves[index])
|
||||
_release_if_possible(component, curve.curve_img, components, all_curves[index])
|
||||
curve_btn.click(curve.curve_img, components, all_curves[index])
|
||||
curve_btn.click(curve.run(points), all_curve_input, image_out)
|
||||
curve_rst_btn.click(lambda: all_curve_defaults, None, all_curve_set)
|
||||
|
|
@ -292,7 +293,7 @@ def add_tab():
|
|||
]
|
||||
all_sk_input = [image_eff] + all_sk_set
|
||||
for component in all_sk_set:
|
||||
component.change(sketch.run, all_sk_input, image_out)
|
||||
_release_if_possible(component, sketch.run, all_sk_input, image_out)
|
||||
sketch_btn.click(sketch.run, all_sk_input, image_out)
|
||||
sketch_rst_btn.click(lambda: [0, 1.4, 1.6, -0.03, 10, 1, 'gray', False], None, all_sk_set)
|
||||
|
||||
|
|
@ -302,7 +303,7 @@ def add_tab():
|
|||
]
|
||||
all_p_input = [image_eff] + all_p_set
|
||||
for component in all_p_set:
|
||||
component.change(pixel.run, all_p_input, image_out)
|
||||
_release_if_possible(component, pixel.run, all_p_input, image_out)
|
||||
pixel_btn.click(pixel.run, all_p_input, image_out)
|
||||
pixel_rst_btn.click(lambda: [16, 8, 0, 5, 'kmeans'], None, all_p_set)
|
||||
|
||||
|
|
@ -312,7 +313,7 @@ def add_tab():
|
|||
]
|
||||
all_neon_input = [image_eff] + all_neon_set
|
||||
for component in all_neon_set:
|
||||
component.change(neon.run, all_neon_input, image_out)
|
||||
_release_if_possible(component, neon.run, all_neon_input, image_out)
|
||||
neon_btn.click(neon.run, all_neon_input, image_out)
|
||||
neon_rst_btn.click(lambda: [16, 1, 'BS'], None, all_neon_set)
|
||||
|
||||
|
|
@ -322,7 +323,7 @@ def add_tab():
|
|||
]
|
||||
all_iop_input = [image_other] + all_iop_set
|
||||
for component in all_iop_set:
|
||||
component.change(outpaint.run, all_iop_input, [image_out, image_mask])
|
||||
_release_if_possible(component, outpaint.run, all_iop_input, [image_out, image_mask])
|
||||
iop_btn.click(outpaint.run, all_iop_input, [image_out, image_mask])
|
||||
|
||||
#send
|
||||
|
|
@ -349,6 +350,13 @@ def add_tab():
|
|||
return (demo , "HakuImg", "haku_img"),
|
||||
|
||||
|
||||
def _release_if_possible(component, *args, **kwargs):
|
||||
if isinstance(component, gr.events.Releaseable):
|
||||
component.release(*args, **kwargs)
|
||||
else:
|
||||
component.change(*args, **kwargs)
|
||||
|
||||
|
||||
def on_ui_settings():
|
||||
section = ('haku-img', "HakuImg")
|
||||
shared.opts.add_option(
|
||||
|
|
|
|||
Loading…
Reference in New Issue