Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -87,11 +87,12 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
|
|
87 |
# raise gr.Error("You must select a LoRA before proceeding.")
|
88 |
progress(0, desc="Preparing Inference.")
|
89 |
|
|
|
90 |
if is_valid_lora(lora_json):
|
91 |
with calculateDuration("Loading LoRA weights"):
|
92 |
fuse_loras(pipe, lora_json)
|
93 |
trigger_word = get_trigger_word(lora_json)
|
94 |
-
|
95 |
selected_lora = loras[selected_index]
|
96 |
lora_path = selected_lora["repo"]
|
97 |
trigger_word = selected_lora["trigger_word"]
|
@@ -101,7 +102,6 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
|
|
101 |
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
|
102 |
else:
|
103 |
pipe.load_lora_weights(lora_path)
|
104 |
-
else: trigger_word = ""
|
105 |
|
106 |
# Set random seed for reproducibility
|
107 |
with calculateDuration("Randomizing seed"):
|
@@ -251,8 +251,8 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_width=True, css=css) as app:
|
|
251 |
gr.on(
|
252 |
triggers=[lora_download.click, lora_download_url.submit],
|
253 |
fn=download_my_lora,
|
254 |
-
inputs=[lora_download_url, lora_repo[lambda i:
|
255 |
-
outputs=[lora_repo[lambda i:
|
256 |
scroll_to_output=True,
|
257 |
queue=True,
|
258 |
show_api=False,
|
|
|
87 |
# raise gr.Error("You must select a LoRA before proceeding.")
|
88 |
progress(0, desc="Preparing Inference.")
|
89 |
|
90 |
+
trigger_word = ""
|
91 |
if is_valid_lora(lora_json):
|
92 |
with calculateDuration("Loading LoRA weights"):
|
93 |
fuse_loras(pipe, lora_json)
|
94 |
trigger_word = get_trigger_word(lora_json)
|
95 |
+
if selected_index is not None:
|
96 |
selected_lora = loras[selected_index]
|
97 |
lora_path = selected_lora["repo"]
|
98 |
trigger_word = selected_lora["trigger_word"]
|
|
|
102 |
pipe.load_lora_weights(lora_path, weight_name=selected_lora["weights"])
|
103 |
else:
|
104 |
pipe.load_lora_weights(lora_path)
|
|
|
105 |
|
106 |
# Set random seed for reproducibility
|
107 |
with calculateDuration("Randomizing seed"):
|
|
|
251 |
gr.on(
|
252 |
triggers=[lora_download.click, lora_download_url.submit],
|
253 |
fn=download_my_lora,
|
254 |
+
inputs=[lora_download_url, lora_repo[int(lambda i: i - 1, lora_slot)]],
|
255 |
+
outputs=[lora_repo[int(lambda i: i - 1, lora_slot)]],
|
256 |
scroll_to_output=True,
|
257 |
queue=True,
|
258 |
show_api=False,
|