Spaces:
Starting
on
A10G
Starting
on
A10G
Linoy Tsaban
commited on
Commit
•
4843bd8
1
Parent(s):
d7cae1e
Update app.py
Browse files
app.py
CHANGED
@@ -317,32 +317,16 @@ with gr.Blocks(css="style.css") as demo:
|
|
317 |
else:
|
318 |
return row2.update(visible=True), row2_advanced.update(visible=True), row3.update(visible=True), row3_advanced.update(visible=True), add_concept_button.update(visible=False), 3
|
319 |
|
320 |
-
def
|
321 |
guidance_scale_label = "Concept Guidance Scale"
|
322 |
-
|
323 |
-
|
|
|
|
|
324 |
guidance_scale_label = "Negative Guidance Scale"
|
325 |
-
return
|
326 |
else: # remove
|
327 |
-
return
|
328 |
-
|
329 |
-
def update_display_concept_2(add_2, edit_concept_2, neg_guidance_2):
|
330 |
-
guidance_scale_label = "Concept Guidance Scale"
|
331 |
-
if (add_2 == 'Include' or add_2 == 'Remove') and edit_concept_2 != "":
|
332 |
-
if neg_guidance_1:
|
333 |
-
guidance_scale_label = "Negative Guidance Scale"
|
334 |
-
return box2.update(visible=True), edit_concept_2, concept_2.update(visible=True),edit_concept_2, guidnace_scale_2.update(visible=True), neg_guidance_2, "Clear", gr.update(interactive=False), gr.update(interactive=False),gr.update(interactive=False),gr.update(label = guidance_scale_label)
|
335 |
-
else: # remove
|
336 |
-
return box2.update(visible=False),"", concept_2.update(visible=False), "", guidnace_scale_2.update(visible=False), False, "Include", gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True),gr.update(label = guidance_scale_label)
|
337 |
-
|
338 |
-
def update_display_concept_3(add_3, edit_concept_3, neg_guidance_3):
|
339 |
-
guidance_scale_label = "Concept Guidance Scale"
|
340 |
-
if (add_3 == 'Include'or add_3 == 'Remove') and edit_concept_3 != "":
|
341 |
-
if neg_guidance_1:
|
342 |
-
guidance_scale_label = "Negative Guidance Scale"
|
343 |
-
return box3.update(visible=True), edit_concept_3, concept_3.update(visible=True), edit_concept_3, guidnace_scale_3.update(visible=True), neg_guidance_3, "Clear", gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False),gr.update(label = guidance_scale_label)
|
344 |
-
else: # remove
|
345 |
-
return box3.update(visible=False), "", concept_3.update(visible=False), "", guidnace_scale_3.update(visible=False), False, "Include", gr.update(interactive=True), gr.update(interactive=True),gr.update(interactive=True),gr.update(label = guidance_scale_label)
|
346 |
|
347 |
def display_editing_options(run_button, clear_button, sega_tab):
|
348 |
return run_button.update(visible=True), clear_button.update(visible=True), sega_tab.update(visible=True)
|
@@ -494,9 +478,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
494 |
with gr.Column(scale=1, min_width=100):
|
495 |
neg_guidance_3 = gr.Checkbox(
|
496 |
label='Remove Concept?',visible=True)
|
497 |
-
with gr.Column(scale=1, min_width=100):
|
498 |
-
dropdown3 = gr.Dropdown(label = "Edit Type", value ='default' , choices=['default','style', 'object', 'facial'])
|
499 |
with gr.Column(scale=2, min_width=100):
|
|
|
|
|
500 |
add_3 = gr.Button('Include')
|
501 |
|
502 |
|
@@ -563,9 +547,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
563 |
neg_guidance_1.change(fn = update_label, inputs=[neg_guidance_1], outputs=[add_1])
|
564 |
neg_guidance_2.change(fn = update_label, inputs=[neg_guidance_2], outputs=[add_2])
|
565 |
neg_guidance_3.change(fn = update_label, inputs=[neg_guidance_3], outputs=[add_3])
|
566 |
-
add_1.click(fn =
|
567 |
-
add_2.click(fn =
|
568 |
-
add_3.click(fn =
|
569 |
|
570 |
add_concept_button.click(fn = add_concept, inputs=sega_concepts_counter,
|
571 |
outputs= [row2, row2_advanced, row3, row3_advanced, add_concept_button, sega_concepts_counter], queue = False)
|
|
|
317 |
else:
|
318 |
return row2.update(visible=True), row2_advanced.update(visible=True), row3.update(visible=True), row3_advanced.update(visible=True), add_concept_button.update(visible=False), 3
|
319 |
|
320 |
+
def update_display_concept(add, edit_concept, neg_guidance):
|
321 |
guidance_scale_label = "Concept Guidance Scale"
|
322 |
+
disable_interactive = gr.update(interactive=False)
|
323 |
+
enable_interactive = gr.update(interactive=True)
|
324 |
+
if (add == 'Include' or add == 'Remove') and edit_concept != "":
|
325 |
+
if neg_guidance:
|
326 |
guidance_scale_label = "Negative Guidance Scale"
|
327 |
+
return gr.update(visible=True), edit_concept,gr.update(visible=True), edit_concept, gr.update(visible=True), neg_guidance, "Clear",disable_interactive, disable_interactive, disable_interactive, gr.update(label = guidance_scale_label)
|
328 |
else: # remove
|
329 |
+
return gr.update(visible=False),"", gr.update(visible=False), "", gr.update(visible=False), False, "Include", enable_interactive,enable_interactive,enable_interactive,gr.update(label = guidance_scale_label)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
|
331 |
def display_editing_options(run_button, clear_button, sega_tab):
|
332 |
return run_button.update(visible=True), clear_button.update(visible=True), sega_tab.update(visible=True)
|
|
|
478 |
with gr.Column(scale=1, min_width=100):
|
479 |
neg_guidance_3 = gr.Checkbox(
|
480 |
label='Remove Concept?',visible=True)
|
|
|
|
|
481 |
with gr.Column(scale=2, min_width=100):
|
482 |
+
dropdown3 = gr.Dropdown(label = "Edit Type", value ='default' , choices=['default','style', 'object', 'facial'])
|
483 |
+
with gr.Column(scale=1, min_width=100):
|
484 |
add_3 = gr.Button('Include')
|
485 |
|
486 |
|
|
|
547 |
neg_guidance_1.change(fn = update_label, inputs=[neg_guidance_1], outputs=[add_1])
|
548 |
neg_guidance_2.change(fn = update_label, inputs=[neg_guidance_2], outputs=[add_2])
|
549 |
neg_guidance_3.change(fn = update_label, inputs=[neg_guidance_3], outputs=[add_3])
|
550 |
+
add_1.click(fn = update_display_concept, inputs=[add_1, edit_concept_1, neg_guidance_1], outputs=[box1, concept_1, concept_1, edit_concept_1, guidnace_scale_1,neg_guidance_1, add_1, edit_concept_1,neg_guidance_1, dropdown1, guidnace_scale_1])
|
551 |
+
add_2.click(fn = update_display_concept, inputs=[add_2, edit_concept_2, neg_guidance_2], outputs=[box2, concept_2, concept_2, edit_concept_2, guidnace_scale_2,neg_guidance_2, add_2, edit_concept_2,neg_guidance_2 , dropdown2,guidnace_scale_2])
|
552 |
+
add_3.click(fn = update_display_concept, inputs=[add_3, edit_concept_3, neg_guidance_3], outputs=[box3, concept_3, concept_3, edit_concept_3, guidnace_scale_3,neg_guidance_3, add_3, edit_concept_3, neg_guidance_3, dropdown3, guidnace_scale_3])
|
553 |
|
554 |
add_concept_button.click(fn = add_concept, inputs=sega_concepts_counter,
|
555 |
outputs= [row2, row2_advanced, row3, row3_advanced, add_concept_button, sega_concepts_counter], queue = False)
|