Commit
·
a0829bf
1
Parent(s):
47a017a
Fix wrong examples count
Browse files
app.py
CHANGED
|
@@ -268,15 +268,15 @@ def swap_visibilities(input_image,
|
|
| 268 |
steps,
|
| 269 |
skip,
|
| 270 |
tar_cfg_scale,
|
| 271 |
-
sega_concepts_counter
|
| 272 |
|
| 273 |
):
|
| 274 |
concept1_update = update_display_concept("Remove" if neg_guidance_1 else "Add", edit_concept_1, neg_guidance_1, sega_concepts_counter)
|
| 275 |
if(edit_concept_2 != ""):
|
| 276 |
-
concept2_update = update_display_concept("Remove" if neg_guidance_2 else "Add", edit_concept_2, neg_guidance_2, sega_concepts_counter)
|
| 277 |
else:
|
| 278 |
-
concept2_update = gr.update(visible=False), gr.update(visible=False),gr.update(visible=False), gr.update(value=neg_guidance_2),gr.update(visible=True),gr.update(visible=False),sega_concepts_counter
|
| 279 |
-
return (*concept1_update
|
| 280 |
|
| 281 |
|
| 282 |
|
|
@@ -359,7 +359,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 359 |
|
| 360 |
|
| 361 |
def update_display_concept(button_label, edit_concept, neg_guidance, sega_concepts_counter):
|
| 362 |
-
sega_concepts_counter+=1
|
| 363 |
guidance_scale_label = "Concept Guidance Scale"
|
| 364 |
if(button_label=='Remove'):
|
| 365 |
neg_guidance = True
|
|
@@ -378,18 +378,12 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 378 |
def display_editing_options(run_button, clear_button, sega_tab):
|
| 379 |
return run_button.update(visible=True), clear_button.update(visible=True), sega_tab.update(visible=True)
|
| 380 |
|
| 381 |
-
def update_label(neg_gudiance, add_button_label):
|
| 382 |
-
if (neg_gudiance):
|
| 383 |
-
return "Remove"
|
| 384 |
-
else:
|
| 385 |
-
return "Include"
|
| 386 |
def update_interactive_mode(add_button_label):
|
| 387 |
if add_button_label == "Clear":
|
| 388 |
return gr.update(interactive=False), gr.update(interactive=False)
|
| 389 |
else:
|
| 390 |
return gr.update(interactive=True), gr.update(interactive=True)
|
| 391 |
|
| 392 |
-
|
| 393 |
def update_dropdown_parms(dropdown):
|
| 394 |
if dropdown == 'custom':
|
| 395 |
return DEFAULT_SEGA_CONCEPT_GUIDANCE_SCALE,DEFAULT_WARMUP_STEPS, DEFAULT_THRESHOLD
|
|
@@ -538,7 +532,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 538 |
with gr.Column(scale=2, min_width=100):
|
| 539 |
dropdown3 = gr.Dropdown(label = "Edit Type", value ='custom' , choices=['custom','style', 'object', 'facial'])
|
| 540 |
with gr.Column(scale=1, min_width=100):
|
| 541 |
-
add_3 = gr.Button('
|
| 542 |
remove_3 = gr.Button('Remove')
|
| 543 |
|
| 544 |
with gr.Row(visible=False).style(equal_height=True) as row4:
|
|
@@ -785,8 +779,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 785 |
tar_cfg_scale,
|
| 786 |
sega_concepts_counter
|
| 787 |
],
|
| 788 |
-
outputs=[box1, concept_1, guidnace_scale_1,neg_guidance_1, row1, row2,
|
| 789 |
-
cache_examples=True
|
| 790 |
)
|
| 791 |
|
| 792 |
|
|
|
|
| 268 |
steps,
|
| 269 |
skip,
|
| 270 |
tar_cfg_scale,
|
| 271 |
+
sega_concepts_counter
|
| 272 |
|
| 273 |
):
|
| 274 |
concept1_update = update_display_concept("Remove" if neg_guidance_1 else "Add", edit_concept_1, neg_guidance_1, sega_concepts_counter)
|
| 275 |
if(edit_concept_2 != ""):
|
| 276 |
+
concept2_update = update_display_concept("Remove" if neg_guidance_2 else "Add", edit_concept_2, neg_guidance_2, sega_concepts_counter+1)
|
| 277 |
else:
|
| 278 |
+
concept2_update = gr.update(visible=False), gr.update(visible=False),gr.update(visible=False), gr.update(value=neg_guidance_2),gr.update(visible=True),gr.update(visible=False),sega_concepts_counter+1
|
| 279 |
+
return (*concept1_update[:-1], *concept2_update)
|
| 280 |
|
| 281 |
|
| 282 |
|
|
|
|
| 359 |
|
| 360 |
|
| 361 |
def update_display_concept(button_label, edit_concept, neg_guidance, sega_concepts_counter):
|
| 362 |
+
sega_concepts_counter += 1
|
| 363 |
guidance_scale_label = "Concept Guidance Scale"
|
| 364 |
if(button_label=='Remove'):
|
| 365 |
neg_guidance = True
|
|
|
|
| 378 |
def display_editing_options(run_button, clear_button, sega_tab):
|
| 379 |
return run_button.update(visible=True), clear_button.update(visible=True), sega_tab.update(visible=True)
|
| 380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
def update_interactive_mode(add_button_label):
|
| 382 |
if add_button_label == "Clear":
|
| 383 |
return gr.update(interactive=False), gr.update(interactive=False)
|
| 384 |
else:
|
| 385 |
return gr.update(interactive=True), gr.update(interactive=True)
|
| 386 |
|
|
|
|
| 387 |
def update_dropdown_parms(dropdown):
|
| 388 |
if dropdown == 'custom':
|
| 389 |
return DEFAULT_SEGA_CONCEPT_GUIDANCE_SCALE,DEFAULT_WARMUP_STEPS, DEFAULT_THRESHOLD
|
|
|
|
| 532 |
with gr.Column(scale=2, min_width=100):
|
| 533 |
dropdown3 = gr.Dropdown(label = "Edit Type", value ='custom' , choices=['custom','style', 'object', 'facial'])
|
| 534 |
with gr.Column(scale=1, min_width=100):
|
| 535 |
+
add_3 = gr.Button('Add')
|
| 536 |
remove_3 = gr.Button('Remove')
|
| 537 |
|
| 538 |
with gr.Row(visible=False).style(equal_height=True) as row4:
|
|
|
|
| 779 |
tar_cfg_scale,
|
| 780 |
sega_concepts_counter
|
| 781 |
],
|
| 782 |
+
outputs=[box1, concept_1, guidnace_scale_1,neg_guidance_1, row1, row2,box2, concept_2, guidnace_scale_2,neg_guidance_2,row2, row3,sega_concepts_counter],
|
|
|
|
| 783 |
)
|
| 784 |
|
| 785 |
|