Spaces:
Runtime error
Runtime error
Commit
•
6b83f3e
1
Parent(s):
743097a
Update app.py
Browse files
app.py
CHANGED
@@ -458,25 +458,28 @@ def show_loading_widget():
|
|
458 |
return gr.update(visible=True)
|
459 |
|
460 |
def load_custom_lora(link):
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
<
|
470 |
-
|
|
|
|
|
|
|
471 |
</div>
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
return gr.update(visible=
|
479 |
-
|
480 |
def remove_custom_lora():
|
481 |
return "", gr.update(visible=False), gr.update(visible=False), None
|
482 |
with gr.Blocks(css="custom.css") as demo:
|
|
|
458 |
return gr.update(visible=True)
|
459 |
|
460 |
def load_custom_lora(link):
|
461 |
+
if(link):
|
462 |
+
try:
|
463 |
+
title, path, trigger_word, image = check_custom_model(link)
|
464 |
+
card = f'''
|
465 |
+
<div class="custom_lora_card">
|
466 |
+
<span>Loaded custom LoRA:</span>
|
467 |
+
<div class="card_internal">
|
468 |
+
<img src="{image}" />
|
469 |
+
<div>
|
470 |
+
<h3>{title}</h3>
|
471 |
+
<small>{"Using: <code><b>"+trigger_word+"</code></b> as the trigger word" if trigger_word else "No trigger word found. If there's a trigger word, include it in your prompt"}<br></small>
|
472 |
+
</div>
|
473 |
+
</div>
|
474 |
</div>
|
475 |
+
'''
|
476 |
+
return gr.update(visible=True), card, gr.update(visible=True), [path, trigger_word], gr.Gallery(selected_index=None), f"Custom: {path}"
|
477 |
+
except Exception as e:
|
478 |
+
gr.Warning("Invalid LoRA: either you entered an invalid link, a non-SDXL LoRA or a LoRA with mature content")
|
479 |
+
return gr.update(visible=True), "Invalid LoRA: either you entered an invalid link, a non-SDXL LoRA or a LoRA with mature content", gr.update(visible=False), None, gr.update(visible=True), gr.update(visible=True)
|
480 |
+
else:
|
481 |
+
return gr.update(visible=False), "", gr.update(visible=False), None, gr.update(visible=True), gr.update(visible=True)
|
482 |
+
|
483 |
def remove_custom_lora():
|
484 |
return "", gr.update(visible=False), gr.update(visible=False), None
|
485 |
with gr.Blocks(css="custom.css") as demo:
|