Spaces:
Running on Zero
Running on Zero
File size: 2,805 Bytes
6a07ce1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | """Pipeline loader tab for SDXL Model Merger."""
import gradio as gr
from ..config import (
DEFAULT_CHECKPOINT_URL,
DEFAULT_VAE_URL,
DEFAULT_LORA_URLS,
)
from ..pipeline import load_pipeline, cancel_download
def create_loader_tab():
"""Create the pipeline loading tab with all input controls."""
with gr.Accordion("⚙️ 1. Load Pipeline", open=True, elem_classes=["feature-card"]):
with gr.Row():
with gr.Column(scale=2):
# Checkpoint URL
checkpoint_url = gr.Textbox(
label="Base Model (.safetensors) URL",
value=DEFAULT_CHECKPOINT_URL,
placeholder="e.g., https://civitai.com/api/download/models/...",
info="Download link for the base SDXL checkpoint"
)
# VAE URL (optional)
vae_url = gr.Textbox(
label="VAE (.safetensors) URL",
value=DEFAULT_VAE_URL,
placeholder="Leave blank to use model's built-in VAE",
info="Optional custom VAE for improved quality"
)
with gr.Column(scale=1):
# LoRA URLs
lora_urls = gr.Textbox(
label="LoRA URLs (one per line)",
lines=5,
value=DEFAULT_LORA_URLS,
placeholder="https://civit.ai/...\nhttps://huggingface.co/...",
info="Multiple LoRAs can be loaded and fused together"
)
# LoRA strengths
lora_strengths = gr.Textbox(
label="LoRA Strengths",
value="1.0",
placeholder="e.g., 0.8,1.0,0.5",
info="Comma-separated strength values for each LoRA"
)
# Action buttons
with gr.Row():
load_btn = gr.Button("🚀 Load Pipeline", variant="primary", size="lg")
cancel_btn = gr.Button("🛑 Cancel Download", variant="stop", size="lg")
# Status output
load_status = gr.Textbox(
label="Status",
placeholder="Ready to load pipeline...",
show_label=True,
)
return (
checkpoint_url, vae_url, lora_urls, lora_strengths,
load_btn, cancel_btn, load_status
)
def setup_loader_events(
checkpoint_url, vae_url, lora_urls, lora_strengths,
load_btn, cancel_btn, load_status
):
"""Setup event handlers for the loader tab."""
load_btn.click(
fn=load_pipeline,
inputs=[checkpoint_url, vae_url, lora_urls, lora_strengths],
outputs=load_status,
)
cancel_btn.click(fn=cancel_download)
|