Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
03ae30f
1
Parent(s):
216714c
Fix gallery behavior when adding custom LoRA (#3)
Browse files- Fix gallery behavior when adding custom LoRA (14408dadee3ffe7a77cb31966c4c8b67b20bbc93)
Co-authored-by: John Smith <[email protected]>
app.py
CHANGED
@@ -170,7 +170,7 @@ def randomize_loras(selected_indices, loras_state):
|
|
170 |
random_prompt = random.choice(prompt_values)
|
171 |
return selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2, random_prompt
|
172 |
|
173 |
-
def add_custom_lora(custom_lora, selected_indices, current_loras):
|
174 |
if custom_lora:
|
175 |
try:
|
176 |
title, repo, path, trigger_word, image = check_custom_model(custom_lora)
|
@@ -232,7 +232,7 @@ def add_custom_lora(custom_lora, selected_indices, current_loras):
|
|
232 |
else:
|
233 |
return current_loras, gr.update(), gr.update(), gr.update(), selected_indices, gr.update(), gr.update(), gr.update(), gr.update()
|
234 |
|
235 |
-
def remove_custom_lora(selected_indices, current_loras):
|
236 |
if current_loras:
|
237 |
custom_lora_repo = current_loras[-1]['repo']
|
238 |
# Remove from loras list
|
@@ -562,12 +562,12 @@ with gr.Blocks(css=css, delete_cache=(60, 3600)) as app:
|
|
562 |
)
|
563 |
add_custom_lora_button.click(
|
564 |
add_custom_lora,
|
565 |
-
inputs=[custom_lora, selected_indices, loras_state],
|
566 |
outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
|
567 |
)
|
568 |
remove_custom_lora_button.click(
|
569 |
remove_custom_lora,
|
570 |
-
inputs=[selected_indices, loras_state],
|
571 |
outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
|
572 |
)
|
573 |
gr.on(
|
|
|
170 |
random_prompt = random.choice(prompt_values)
|
171 |
return selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2, random_prompt
|
172 |
|
173 |
+
def add_custom_lora(custom_lora, selected_indices, current_loras, gallery):
|
174 |
if custom_lora:
|
175 |
try:
|
176 |
title, repo, path, trigger_word, image = check_custom_model(custom_lora)
|
|
|
232 |
else:
|
233 |
return current_loras, gr.update(), gr.update(), gr.update(), selected_indices, gr.update(), gr.update(), gr.update(), gr.update()
|
234 |
|
235 |
+
def remove_custom_lora(selected_indices, current_loras, gallery):
|
236 |
if current_loras:
|
237 |
custom_lora_repo = current_loras[-1]['repo']
|
238 |
# Remove from loras list
|
|
|
562 |
)
|
563 |
add_custom_lora_button.click(
|
564 |
add_custom_lora,
|
565 |
+
inputs=[custom_lora, selected_indices, loras_state, gallery],
|
566 |
outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
|
567 |
)
|
568 |
remove_custom_lora_button.click(
|
569 |
remove_custom_lora,
|
570 |
+
inputs=[selected_indices, loras_state, gallery],
|
571 |
outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
|
572 |
)
|
573 |
gr.on(
|