Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
0052f82
1
Parent(s):
cde127d
Update app.py
Browse files
app.py
CHANGED
@@ -94,9 +94,10 @@ def shuffle_images():
|
|
94 |
compatible_items = [item for item in sdxl_loras if item['is_compatible']]
|
95 |
random.shuffle(compatible_items)
|
96 |
two_shuffled_items = compatible_items[:2]
|
97 |
-
title_1
|
98 |
title_2 = gr.update(label=two_shuffled_items[1]['title'], value=two_shuffled_items[1]['image'])
|
99 |
-
|
|
|
100 |
description_1, trigger_word_1 = get_description(two_shuffled_items[0])
|
101 |
description_2, trigger_word_2 = get_description(two_shuffled_items[1])
|
102 |
|
@@ -105,7 +106,7 @@ def shuffle_images():
|
|
105 |
prompt = gr.update(value=f"{trigger_word_1} {trigger_word_2}")
|
106 |
scale = gr.update(value=0.7)
|
107 |
|
108 |
-
return title_1, prompt_description_1, title_2, prompt_description_2, prompt, two_shuffled_items, scale, scale
|
109 |
|
110 |
with gr.Blocks(css=css) as demo:
|
111 |
shuffled_items = gr.State()
|
@@ -120,11 +121,13 @@ with gr.Blocks(css=css) as demo:
|
|
120 |
with gr.Row():
|
121 |
with gr.Column(min_width=10, scale=3, elem_classes="random_column"):
|
122 |
lora_1 = gr.Image(interactive=False, height=150, elem_classes="selected_random", elem_id="randomLoRA_1", show_share_button=False, show_download_button=False)
|
|
|
123 |
lora_1_prompt = gr.Markdown(visible=False)
|
124 |
with gr.Column(min_width=10, scale=1, elem_classes="plus_column"):
|
125 |
plus = gr.HTML("+", elem_classes="plus_button")
|
126 |
with gr.Column(min_width=10, scale=3, elem_classes="random_column"):
|
127 |
lora_2 = gr.Image(interactive=False, height=150, elem_classes="selected_random", elem_id="randomLoRA_2", show_share_button=False, show_download_button=False)
|
|
|
128 |
lora_2_prompt = gr.Markdown(visible=False)
|
129 |
with gr.Column(min_width=10, scale=2, elem_classes="plus_column"):
|
130 |
equal = gr.HTML("=", elem_classes="plus_button")
|
@@ -152,8 +155,8 @@ with gr.Blocks(css=css) as demo:
|
|
152 |
lora_2_scale = gr.Slider(label="LoRa 2 Scale", minimum=0, maximum=1, step=0.1, value=0.7)
|
153 |
shuffle_button = gr.Button("Reshuffle!")
|
154 |
|
155 |
-
demo.load(shuffle_images, inputs=[], outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
156 |
-
shuffle_button.click(shuffle_images, outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
157 |
|
158 |
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|
159 |
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|
|
|
94 |
compatible_items = [item for item in sdxl_loras if item['is_compatible']]
|
95 |
random.shuffle(compatible_items)
|
96 |
two_shuffled_items = compatible_items[:2]
|
97 |
+
title_1 = gr.update(label=two_shuffled_items[0]['title'], value=two_shuffled_items[0]['image'])
|
98 |
title_2 = gr.update(label=two_shuffled_items[1]['title'], value=two_shuffled_items[1]['image'])
|
99 |
+
repo_id_1 = gr.update(value=two_shuffled_items[0]['repo'])
|
100 |
+
repo_id_2 = gr.update(value=two_shuffled_items[1]['repo'])
|
101 |
description_1, trigger_word_1 = get_description(two_shuffled_items[0])
|
102 |
description_2, trigger_word_2 = get_description(two_shuffled_items[1])
|
103 |
|
|
|
106 |
prompt = gr.update(value=f"{trigger_word_1} {trigger_word_2}")
|
107 |
scale = gr.update(value=0.7)
|
108 |
|
109 |
+
return title_1, prompt_description_1, repo_id_1, title_2, prompt_description_2, repo_id_2, prompt, two_shuffled_items, scale, scale
|
110 |
|
111 |
with gr.Blocks(css=css) as demo:
|
112 |
shuffled_items = gr.State()
|
|
|
121 |
with gr.Row():
|
122 |
with gr.Column(min_width=10, scale=3, elem_classes="random_column"):
|
123 |
lora_1 = gr.Image(interactive=False, height=150, elem_classes="selected_random", elem_id="randomLoRA_1", show_share_button=False, show_download_button=False)
|
124 |
+
lora_1_id = gr.Textbox(visible=False)
|
125 |
lora_1_prompt = gr.Markdown(visible=False)
|
126 |
with gr.Column(min_width=10, scale=1, elem_classes="plus_column"):
|
127 |
plus = gr.HTML("+", elem_classes="plus_button")
|
128 |
with gr.Column(min_width=10, scale=3, elem_classes="random_column"):
|
129 |
lora_2 = gr.Image(interactive=False, height=150, elem_classes="selected_random", elem_id="randomLoRA_2", show_share_button=False, show_download_button=False)
|
130 |
+
lora_2_id = gr.Textbox(visible=False)
|
131 |
lora_2_prompt = gr.Markdown(visible=False)
|
132 |
with gr.Column(min_width=10, scale=2, elem_classes="plus_column"):
|
133 |
equal = gr.HTML("=", elem_classes="plus_button")
|
|
|
155 |
lora_2_scale = gr.Slider(label="LoRa 2 Scale", minimum=0, maximum=1, step=0.1, value=0.7)
|
156 |
shuffle_button = gr.Button("Reshuffle!")
|
157 |
|
158 |
+
demo.load(shuffle_images, inputs=[], outputs=[lora_1, lora_1_prompt, lora_1_id, lora_2, lora_2_prompt, lora_2_id, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
159 |
+
shuffle_button.click(shuffle_images, outputs=[lora_1, lora_1_prompt, lora_1_id, lora_2, lora_2_prompt, lora_2_id, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
160 |
|
161 |
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|
162 |
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|