Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
•
87f18df
1
Parent(s):
45f6abe
local support
Browse files
app.py
CHANGED
@@ -498,6 +498,20 @@ def load_custom_lora(link):
|
|
498 |
|
499 |
def remove_custom_lora():
|
500 |
return "", gr.update(visible=False), gr.update(visible=False), None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
with gr.Blocks(css="custom.css") as demo:
|
502 |
gr_sdxl_loras = gr.State(value=sdxl_loras_raw)
|
503 |
title = gr.HTML(
|
@@ -535,6 +549,9 @@ with gr.Blocks(css="custom.css") as demo:
|
|
535 |
custom_model = gr.Textbox(label="or enter a custom Hugging Face or CivitAI SDXL LoRA (Example: https://civitai.com/models/262880/eldritch-comics-comic-book-style-illustration?modelVersionId=305491)", placeholder="Paste Hugging Face or CivitAI model path...")
|
536 |
custom_model_card = gr.HTML(visible=False)
|
537 |
custom_model_button = gr.Button("Remove custom LoRA", visible=False)
|
|
|
|
|
|
|
538 |
with gr.Column(scale=5):
|
539 |
with gr.Row():
|
540 |
prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, info="Describe your subject (optional)", value="a person", elem_id="prompt")
|
@@ -582,6 +599,11 @@ with gr.Blocks(css="custom.css") as demo:
|
|
582 |
queue=False,
|
583 |
show_progress=False
|
584 |
)
|
|
|
|
|
|
|
|
|
|
|
585 |
#new_gallery.select(
|
586 |
# fn=update_selection,
|
587 |
# inputs=[gr_sdxl_loras_new, gr.State(True)],
|
|
|
498 |
|
499 |
def remove_custom_lora():
|
500 |
return "", gr.update(visible=False), gr.update(visible=False), None
|
501 |
+
|
502 |
+
def select(explorer):
|
503 |
+
card = f'''
|
504 |
+
<div class="custom_lora_card" style="padding: 10px">
|
505 |
+
<span>Loaded custom LoRA:</span>
|
506 |
+
<div class="card_internal">
|
507 |
+
<div>
|
508 |
+
<small><code>{explorer}</code></small>
|
509 |
+
</div>
|
510 |
+
</div>
|
511 |
+
</div>
|
512 |
+
'''
|
513 |
+
return gr.update(visible=True), card, gr.update(visible=True), [explorer, ""], gr.Gallery(selected_index=None), f"Custom: {explorer}"
|
514 |
+
|
515 |
with gr.Blocks(css="custom.css") as demo:
|
516 |
gr_sdxl_loras = gr.State(value=sdxl_loras_raw)
|
517 |
title = gr.HTML(
|
|
|
549 |
custom_model = gr.Textbox(label="or enter a custom Hugging Face or CivitAI SDXL LoRA (Example: https://civitai.com/models/262880/eldritch-comics-comic-book-style-illustration?modelVersionId=305491)", placeholder="Paste Hugging Face or CivitAI model path...")
|
550 |
custom_model_card = gr.HTML(visible=False)
|
551 |
custom_model_button = gr.Button("Remove custom LoRA", visible=False)
|
552 |
+
with gr.Group(elem_id="local"):
|
553 |
+
explorer = gr.FileExplorer(root_dir = "data", file_count="single", glob="*.safetensors", label="or select a local SDXL 1.0 LoRA .saretensors file under the app/data folder")
|
554 |
+
explorer_button = gr.Button("Select", elem_id="select_button")
|
555 |
with gr.Column(scale=5):
|
556 |
with gr.Row():
|
557 |
prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, info="Describe your subject (optional)", value="a person", elem_id="prompt")
|
|
|
599 |
queue=False,
|
600 |
show_progress=False
|
601 |
)
|
602 |
+
explorer_button.click(
|
603 |
+
fn=select,
|
604 |
+
inputs=[explorer],
|
605 |
+
outputs=[custom_model_card, custom_model_card, custom_model_button, custom_loaded_lora, gallery, prompt_title],
|
606 |
+
)
|
607 |
#new_gallery.select(
|
608 |
# fn=update_selection,
|
609 |
# inputs=[gr_sdxl_loras_new, gr.State(True)],
|