Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files
app.py
CHANGED
@@ -110,7 +110,9 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
|
|
110 |
|
111 |
image = generate_image(prompt, trigger_word, steps, seed, cfg_scale, width, height, lora_scale, progress)
|
112 |
pipe.to("cpu")
|
113 |
-
if selected_index is not None
|
|
|
|
|
114 |
clear_cache()
|
115 |
return image, seed
|
116 |
|
@@ -211,7 +213,9 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_width=True, css=css) as app:
|
|
211 |
lora_search_civitai_json = gr.JSON(value={}, visible=False)
|
212 |
lora_search_civitai_desc = gr.Markdown(value="", visible=False)
|
213 |
lora_download_url = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
214 |
-
|
|
|
|
|
215 |
|
216 |
gallery.select(
|
217 |
update_selection,
|
@@ -247,8 +251,8 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_width=True, css=css) as app:
|
|
247 |
gr.on(
|
248 |
triggers=[lora_download.click, lora_download_url.submit],
|
249 |
fn=download_my_lora,
|
250 |
-
inputs=[lora_download_url, lora_repo[
|
251 |
-
outputs=[lora_repo[
|
252 |
scroll_to_output=True,
|
253 |
queue=True,
|
254 |
show_api=False,
|
|
|
110 |
|
111 |
image = generate_image(prompt, trigger_word, steps, seed, cfg_scale, width, height, lora_scale, progress)
|
112 |
pipe.to("cpu")
|
113 |
+
if selected_index is not None:
|
114 |
+
pipe.unload_lora_weights()
|
115 |
+
if is_valid_lora(lora_json): pipe.unfuse_lora()
|
116 |
clear_cache()
|
117 |
return image, seed
|
118 |
|
|
|
213 |
lora_search_civitai_json = gr.JSON(value={}, visible=False)
|
214 |
lora_search_civitai_desc = gr.Markdown(value="", visible=False)
|
215 |
lora_download_url = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
216 |
+
with gr.Row():
|
217 |
+
lora_slot = gr.Slider(label="Set to LoRA slot", minimum=1, maximum=num_loras+1, step=1, value=1)
|
218 |
+
lora_download = gr.Button("Get and set LoRA")
|
219 |
|
220 |
gallery.select(
|
221 |
update_selection,
|
|
|
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(lora_slot.value - 1)]],
|
255 |
+
outputs=[lora_repo[int(lora_slot.value - 1)]],
|
256 |
scroll_to_output=True,
|
257 |
queue=True,
|
258 |
show_api=False,
|
mod.py
CHANGED
@@ -134,7 +134,7 @@ def fuse_loras(pipe, lorajson: list[dict]):
|
|
134 |
w_list.append(d["scale"])
|
135 |
if not a_list: return
|
136 |
pipe.set_adapters(a_list, adapter_weights=w_list)
|
137 |
-
pipe.fuse_lora(adapter_names=a_list, lora_scale=1.0)
|
138 |
#pipe.unload_lora_weights()
|
139 |
|
140 |
|
|
|
134 |
w_list.append(d["scale"])
|
135 |
if not a_list: return
|
136 |
pipe.set_adapters(a_list, adapter_weights=w_list)
|
137 |
+
#pipe.fuse_lora(adapter_names=a_list, lora_scale=1.0)
|
138 |
#pipe.unload_lora_weights()
|
139 |
|
140 |
|