Spaces:
Running
on
Zero
Running
on
Zero
Add more LUT interaction
Browse files
app.py
CHANGED
@@ -119,6 +119,7 @@ from utils.version_info import (
|
|
119 |
|
120 |
input_image_palette = []
|
121 |
current_prerendered_image = gr.State("./images/images/Bee-test-2.png")
|
|
|
122 |
user_dir = constants.TMPDIR
|
123 |
lora_models = get_lora_models()
|
124 |
selected_index = gr.State(value=-1)
|
@@ -768,9 +769,11 @@ def composite_with_control_sync(input_image, sketch_image, slider_value):
|
|
768 |
result_img = alpha_composite_with_control(in_img, sk_img, slider_value)
|
769 |
return result_img
|
770 |
|
771 |
-
def
|
772 |
print(f"Sketch Image: {sketch_image}\n")
|
773 |
sketch, is_dict = get_image_from_dict(sketch_image)
|
|
|
|
|
774 |
return sketch
|
775 |
####################################### DEPTH ESTIMATION #######################################
|
776 |
|
@@ -1193,7 +1196,7 @@ with gr.Blocks(css_paths="style_20250314.css", title=title, theme='Surn/beeuty',
|
|
1193 |
with gr.Column(scale=1):
|
1194 |
with gr.Row():
|
1195 |
sketch_replace_input_image_button = gr.Button("Replace Input Image with sketch", elem_id="sketch_replace_input_image_button", elem_classes="solid")
|
1196 |
-
sketch_replace_lut_example_image_button = gr.Button("Replace Filter Example Image with sketch", elem_id="sketch_replace_lut_example_image_button", elem_classes="solid")
|
1197 |
with gr.Row():
|
1198 |
sketch_alpha_composite_slider = gr.Slider(0,100,50,0.5, label="Sketch Transparancy", elem_id="alpha_composite_slider")
|
1199 |
btn_sketch_alpha_composite = gr.Button("Overlay Sketch on Input Image", elem_id="btn_sketchninput", elem_classes="solid")
|
@@ -1246,6 +1249,12 @@ with gr.Blocks(css_paths="style_20250314.css", title=title, theme='Surn/beeuty',
|
|
1246 |
outputs=[input_image],
|
1247 |
scroll_to_output=True
|
1248 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
1249 |
with gr.Accordion("Color Composite", open = False):
|
1250 |
with gr.Row():
|
1251 |
composite_color = gr.ColorPicker(label="Color", value="#ede9ac44")
|
@@ -1537,10 +1546,15 @@ with gr.Blocks(css_paths="style_20250314.css", title=title, theme='Surn/beeuty',
|
|
1537 |
scroll_to_output=True
|
1538 |
)
|
1539 |
sketch_replace_input_image_button.click(
|
1540 |
-
lambda sketch_image:
|
1541 |
inputs=[sketch_image],
|
1542 |
outputs=[input_image], scroll_to_output=True
|
1543 |
)
|
|
|
|
|
|
|
|
|
|
|
1544 |
##################### model #######################################
|
1545 |
model_textbox.change(
|
1546 |
fn=update_prompt_notes,
|
|
|
119 |
|
120 |
input_image_palette = []
|
121 |
current_prerendered_image = gr.State("./images/images/Bee-test-2.png")
|
122 |
+
current_lut_example_img = gr.State(constants.default_lut_example_img)
|
123 |
user_dir = constants.TMPDIR
|
124 |
lora_models = get_lora_models()
|
125 |
selected_index = gr.State(value=-1)
|
|
|
769 |
result_img = alpha_composite_with_control(in_img, sk_img, slider_value)
|
770 |
return result_img
|
771 |
|
772 |
+
def replace_with_sketch_image(sketch_image, replace_current_lut_example_img: bool = False):
|
773 |
print(f"Sketch Image: {sketch_image}\n")
|
774 |
sketch, is_dict = get_image_from_dict(sketch_image)
|
775 |
+
if replace_current_lut_example_img:
|
776 |
+
current_lut_example_img = sketch
|
777 |
return sketch
|
778 |
####################################### DEPTH ESTIMATION #######################################
|
779 |
|
|
|
1196 |
with gr.Column(scale=1):
|
1197 |
with gr.Row():
|
1198 |
sketch_replace_input_image_button = gr.Button("Replace Input Image with sketch", elem_id="sketch_replace_input_image_button", elem_classes="solid")
|
1199 |
+
#sketch_replace_lut_example_image_button = gr.Button("Replace Filter Example Image with sketch", elem_id="sketch_replace_lut_example_image_button", elem_classes="solid")
|
1200 |
with gr.Row():
|
1201 |
sketch_alpha_composite_slider = gr.Slider(0,100,50,0.5, label="Sketch Transparancy", elem_id="alpha_composite_slider")
|
1202 |
btn_sketch_alpha_composite = gr.Button("Overlay Sketch on Input Image", elem_id="btn_sketchninput", elem_classes="solid")
|
|
|
1249 |
outputs=[input_image],
|
1250 |
scroll_to_output=True
|
1251 |
)
|
1252 |
+
apply_lut_to_sketch_button.click(
|
1253 |
+
lambda lut_filename, sketch_image, lut_intensity: gr.Warning("Please upload an Input Image to get started.") if input_image is None else apply_lut_to_image_path(lut_filename, replace_with_sketch_image(sketch_image, False), lut_intensity)[1],
|
1254 |
+
inputs=[lut_filename, sketch_image, lut_intensity],
|
1255 |
+
outputs=[sketch_image],
|
1256 |
+
scroll_to_output=True
|
1257 |
+
)
|
1258 |
with gr.Accordion("Color Composite", open = False):
|
1259 |
with gr.Row():
|
1260 |
composite_color = gr.ColorPicker(label="Color", value="#ede9ac44")
|
|
|
1546 |
scroll_to_output=True
|
1547 |
)
|
1548 |
sketch_replace_input_image_button.click(
|
1549 |
+
lambda sketch_image: replace_with_sketch_image(sketch_image, False),
|
1550 |
inputs=[sketch_image],
|
1551 |
outputs=[input_image], scroll_to_output=True
|
1552 |
)
|
1553 |
+
# sketch_replace_lut_example_image_button.click(
|
1554 |
+
# lambda sketch_image: replace_with_sketch_image(sketch_image, True),
|
1555 |
+
# inputs=[sketch_image],
|
1556 |
+
# outputs=[lut_example_image], scroll_to_output=True
|
1557 |
+
# )
|
1558 |
##################### model #######################################
|
1559 |
model_textbox.change(
|
1560 |
fn=update_prompt_notes,
|