Spaces:
Running
Running
File size: 3,115 Bytes
f575d14 |
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 |
import gradio as gr
from convert_url_to_diffusers_sdxl_gr import (
convert_url_to_diffusers_repo,
SCHEDULER_CONFIG_MAP,
)
vaes = [""]
loras = [""]
schedulers = list(SCHEDULER_CONFIG_MAP.keys())
css = """"""
with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
gr.Markdown("# Download and convert any Stable Diffusion XL safetensors to Diffusers and create your repo")
gr.Markdown(
f"""
The steps are the following:
- Paste a write-access token from [hf.co/settings/tokens](https://huggingface.co/settings/tokens).
- Input a model download url from the Hub or Civitai or other sites.
- If you want to download a model from Civitai, paste a Civitai API Key.
- Input your new repo name. e.g. 'yourid/newrepo'.
- Click "Submit".
- Patiently wait until the output changes.
"""
)
with gr.Column():
dl_url = gr.Textbox(label="URL to download", placeholder="https://...", value="", max_lines=1)
repo_id = gr.Textbox(label="Your New Repo ID", placeholder="author/model", value="", max_lines=1)
hf_token = gr.Textbox(label="Your HF write token", placeholder="", value="", max_lines=1)
civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
is_half = gr.Checkbox(label="Half precision", value=True)
vae = gr.Dropdown(label="VAE", choices=vaes, value="", allow_custom_value=True)
scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler a")
lora1 = gr.Dropdown(label="LoRA1", choices=loras, value="", allow_custom_value=True)
lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
lora2 = gr.Dropdown(label="LoRA2", choices=loras, value="", allow_custom_value=True)
lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
lora3 = gr.Dropdown(label="LoRA3", choices=loras, value="", allow_custom_value=True)
lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
lora4 = gr.Dropdown(label="LoRA4", choices=loras, value="", allow_custom_value=True)
lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
lora5 = gr.Dropdown(label="LoRA5", choices=loras, value="", allow_custom_value=True)
lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
run_button = gr.Button(value="Submit")
repo_urls = gr.CheckboxGroup(visible=False, choices=[], value=None)
output_md = gr.Markdown(label="Output")
gr.on(
triggers=[run_button.click],
fn=convert_url_to_diffusers_repo,
inputs=[dl_url, repo_id, hf_token, civitai_key, repo_urls, is_half, vae, scheduler,
lora1, lora1s, lora2, lora2s, lora3, lora3s, lora4, lora4s, lora5, lora5s],
outputs=[repo_urls, output_md],
)
demo.queue()
demo.launch()
|