import gradio as gr
from convert_url_to_diffusers_multi_gr import convert_url_to_diffusers_repo, get_dtypes, FLUX_BASE_REPOS, SD35_BASE_REPOS
from presets import (DEFAULT_DTYPE, schedulers, clips, t5s, sdxl_vaes, sdxl_loras, sdxl_preset_dict, sdxl_set_presets,
sd15_vaes, sd15_loras, sd15_preset_dict, sd15_set_presets, flux_vaes, flux_loras, flux_preset_dict, flux_set_presets,
sd35_vaes, sd35_loras, sd35_preset_dict, sd35_set_presets)
import os
HF_USER = os.getenv("HF_USER", "")
HF_REPO = os.getenv("HF_REPO", "")
HF_URL = os.getenv("HF_URL", "")
HF_OW = os.getenv("HF_OW", False)
HF_PR = os.getenv("HF_PR", False)
css = """
.title { font-size: 3em; align-items: center; text-align: center; }
.info { align-items: center; text-align: center; }
.block.result { margin: 1em 0; padding: 1em; box-shadow: 0 0 3px 3px #664422, 0 0 3px 2px #664422 inset; border-radius: 6px; background: #665544; }
.block.result p,
.block.result .prose,
.block-result * {
color: aquamarine;
font-family: "Atma", monospace !important;
font-size: 1.06em;
letter-spacing: 0.50px;
word-spacing: 6px;
}
/* I know that I use a lot of !important instruction..
Yeah, I know it's not really properly recommended to use !important instruction when writing CSS rules ..
But it's because that Gradio interface use also a custom css-theme in gr.Blocks() from: "NoCrypt/miku@>=1.2.2"
And all my !important instructions are for avoiding to get unexpected superceeded by that "NoCrypt/miku@>=1.2.2" css theme skin...
No more, no less!
*/
.setting_tag::before {
content: "::";
font-family: system-ui, monospace !important;
font-size: 1.2em !important;
color: #736819 !important;
font-weight: bold;
display: block;
text-align: center !important;
margin: 0 auto !important;
}
.setting_tag {
margin-top: 1em !important;
font-size: 1.4em !important;
color: darkgoldenrod !important;
padding: 10px !important;
font-weight: normal !important;
border: 2px dotted gold !important;
background: white !important;
word-break: break-word !important;
display: block;
text-align: center !important;
margin: 0 auto !important;
text-shadow: 1px 1px 1px gold !important;
}
.setting_tag::after {
content: "::";
font-family: system-ui, monospace !important;
font-size: 1.2em !important;
color: #736819 !important;
font-weight: bold !important;
display: block !important;
text-align: center !important;
margin: 0 auto !important;
}
a.linkify_1,
a.linkify_1:focus,
a.linkify_1:visited {
color: red !important;
text-decoration: underline !important;
}
a.linkify_1:active,
a.linkify_1:hover {
color: darkred !important;
text-decoration: overline !important;
}
.details_info_block_expanded_override {
font-size: 0.95em !important;
color: grey !important;
padding: 10px !important;
font-weight: bold;
border: none !important;
box-shadow: 1px 1px 2px 3px whitesmoke, 3px 2px 1px 1px grey !important;
background: whitesmoke !important;
word-break: break-word !important;
}
.details_info_block {
font-size: 0.95em !important;
color: grey !important;
padding: 10px !important;
font-weight: bold;
border: none !important;
box-shadow: 1px 1px 2px 3px whitesmoke, 3px 2px 1px 1px grey !important;
background: whitesmoke !important;
word-break: break-word !important;
height: initial !important;
max-height: initial !important;
overflow: auto !important;
}
.details_info_block[is-expanded="False"]::before {
content: "(double-click to expand help...)";
user-select: none;
cursor: pointer;
font-family: "Atma" !important;
font-weight: 500 !important;
letter-spacing: 2px !important;
word-spacing: 5px !important;
color: darkmagenta !important;
display: inline-block !important;
font-size: 0.99em !important;
background: whitesmoke !important;
padding: 10px !important;
border: 2px solid black !important;
}
.details_info_block[is-expanded="False"] {
transition: 1.2s all;
height: 80px !important;
max-height: 80px !important;
overflow: hidden !important;
}
.details_info_block[is-expanded="True"]::before {
content: "(double-click to reduce help...)";
user-select: none;
cursor: pointer;
font-family: "Atma" !important;
font-weight: 500 !important;
letter-spacing: 2px !important;
word-spacing: 5px !important;
color: white !important;
display: block !important;
font-size: 0.99em !important;
background: #1c9e5c !important;
padding: 10px !important;
border: 2px solid black !important;
border-radius: 0px !important;
margin-bottom: 1em !important;
}
.details_info_block[is-expanded="True"] {
transition: 1.2s all;
height: initial !important;
max-height: initial !important;
overflow: auto !important;
margin-bottom: 1em !important;
}
.em_warning {
font-family: "Atma", system-ui !important;
font-weight: 400 !important;
font-style: normal !important;
font-size: 1.3em !important;
word-spacing: 3.2px !important;
color: orangered !important;
}
.spanify_safetensors_base_model {
font-family: "Nunito", system-ui, monospace !important;
font-weight: 600;
color: green !important;
}
.spanify_safetensors_checkpoint_model {
font-family: "Nunito", system-ui, monospace !important;
font-weight: 600;
color: orange !important;
}
.spanify_vae_model {
font-family: "Nunito", system-ui, monospace !important;
font-weight: 600;
color: deeppink !important;
}
.spanify_lora_checkpoint_model {
font-family: "Nunito", system-ui, monospace !important;
font-weight: 600;
color: #8c627b !important;
}
.spanify_other_model {
font-family: "Nunito", system-ui, monospace !important;
font-weight: 600;
color: silver !important;
}
.setting_tag_as_mini {
font-family: "Nunito", serif !important;
font-optical-sizing: auto !important;
font-weight: 600 !important;
font-size: 1.2em !important;
color: darkgoldenrod !important;
padding: 4px !important;
border: 2px dashed gold !important;
background: white !important;
word-break: break-word !important;
display: inline-block !important;
text-shadow: 1px 1px 1px gold !important;
}
li.has_divider_1 {
list-style: none;
}
li.has_divider_1 > div.is_divider_1 {
display: inline-block;
width: 100%;
height: 0.4em;
background: burlywood;
}
.accordion-element,
.accordion-element button:not(.reset-button):not(.primary),
.accordion-element button:not(.reset-button):not(.primary) * {
background: navy !important;
color: white !important;
font-family: "Nunito", serif !important;
font-optical-sizing: auto !important;
font-weight: 600 !important;
font-size: 1.2em !important;
}
/* the issue with a Gradio gr.Tab() component,
is that if we specify a CSS class for it through
the declaration of the well-said component, then,
it would be useless as it don't permit to targetting
the TRUE button tab clickable DOMElement..
so this is a workaround which assume the TAB is at that XPath (at least for Gradio version 5) */
/* any NOT active Gradio tab : */
.tab-wrapper .tab-container[role="tablist"] button[role="tab"]:not(.selected) {
background: red !important;
color: white !important;
font-family: "Nunito", serif !important;
font-optical-sizing: auto !important;
font-weight: 600 !important;
font-size: 1.2em !important;
}
/* the CURRENT active Gradio tab : */
.tab-wrapper .tab-container[role="tablist"] button[role="tab"].selected {
background: green !important;
color: white !important;
font-family: "Nunito", serif !important;
font-optical-sizing: auto !important;
font-weight: 600 !important;
font-size: 1.6em !important;
}
/* here we only target Gradio button
that are reset-button
IN an accordion-element classe */
.accordion-element button.reset-button {
background: #803e3e !important;
color: white !important;
font-family: "Atma", serif !important;
font-weight: 700 !important;
font-style: normal !important;
}
/* here we only target Gradio button
that are primary
IN an accordion-element classe */
.accordion-element button.primary {
background: #5f925e !important;
font-size: 1.6em !important;
font-style: oblique !important;
font-weight: normal !important;
text-transform: uppercase !important;
letter-spacing: 1px !important;
border-bottom-right-radius: 100em !important;
border-bottom-left-radius: 100em !important;
font-family: "Atma", serif !important;
font-weight: 700 !important;
font-style: normal !important;
}
"""
help_dict = {
"hf_username": """
(hf_username)
Your HuggingFace username, no more, no less
""",
"hf_write_token_access": """
(hf_write_token_access)
Your HuggingFace Token with WRITE access
- Your Token with WRITE access can be created for free at
https://huggingface.co/settings/tokens.
please, note once created, note its value somewhere you can retrieve later,
because afterwards it would be no more possible to see its value from the
tokens HuggingFace account page!
""",
}
def help(key):
with gr.Accordion("Help", open=False) as help:
gr.HTML(value=help_dict.get(key, ""))
return help
with gr.Blocks(theme="theNeofr/Syne", fill_width=True, css=css, delete_cache=(60, 3600)) as demo:
gr.Markdown("# Download SDXL / SD 1.5 / SD 3.5 / FLUX.1 safetensors and convert to HF🤗 Diffusers format and create your repo", elem_classes="title")
gr.Markdown(f"""
### ⚠️IMPORTANT NOTICE⚠️
It's dangerous to expose your access token or key to others.
If you do use it, I recommend that you duplicate this space on your own HF account in advance.
Keys and tokens could be set to **Secrets** (`HF_TOKEN`, `CIVITAI_API_KEY`) if it's placed in your own space.
It saves you the trouble of typing them in.
It barely works in the CPU space, but larger files can be converted if duplicated on the more powerful **Zero GPU** space.
In particular, conversion of FLUX.1 or SD 3.5 is almost impossible in CPU space.
### The steps are the following:
1. Paste a write-access token from [hf.co/settings/tokens](https://huggingface.co/settings/tokens).
1. Input a model download url of the Hugging Face or Civitai or other sites.
1. If you want to download a model from Civitai, paste a Civitai API Key.
1. Input your HF user ID. e.g. 'yourid'.
1. Input your new repo name. If empty, auto-complete. e.g. 'newrepo'.
1. Set the parameters. If not sure, just use the defaults.
1. Click "Submit".
1. Patiently wait until the output changes. It takes approximately 2 to 3 minutes (on SDXL models downloading from HF).
""")
with gr.Column():
dl_url = gr.Textbox(label="URL to download", placeholder="https://huggingface.co/bluepen5805/blue_pencil-XL/blob/main/blue_pencil-XL-v7.0.0.safetensors",
value=HF_URL, max_lines=1)
with gr.Group():
with gr.Row():
with gr.Column():
hf_user = gr.Textbox(label="Your HF user ID", placeholder="username", value=HF_USER, max_lines=1)
help("hf_username")
with gr.Column():
hf_repo = gr.Textbox(label="New repo name", placeholder="reponame", info="If empty, auto-complete", value=HF_REPO, max_lines=1)
with gr.Row(equal_height=True):
with gr.Column():
hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
gr.Markdown("Your token is available at [hf.co/settings/tokens](https://huggingface.co/settings/tokens).", elem_classes="info")
help("hf_write_token_access")
with gr.Column():
civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
gr.Markdown("Your Civitai API key is available at [https://civitai.com/user/account](https://civitai.com/user/account).", elem_classes="info")
with gr.Row():
is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
is_private = gr.Checkbox(label="Create private repo", value=True)
gated = gr.Radio(label="Create gated repo", info="Gated repo must be public", choices=["auto", "manual", "False"], value="False")
with gr.Row():
is_overwrite = gr.Checkbox(label="Overwrite repo", value=HF_OW)
is_pr = gr.Checkbox(label="Create PR", value=HF_PR)
with gr.Tab("SDXL"):
with gr.Group():
sdxl_presets = gr.Radio(label="Presets", choices=list(sdxl_preset_dict.keys()), value=list(sdxl_preset_dict.keys())[0])
sdxl_mtype = gr.Textbox(value="SDXL", visible=False)
sdxl_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value=DEFAULT_DTYPE)
with gr.Accordion("Advanced settings", open=False):
with gr.Row():
sdxl_vae = gr.Dropdown(label="VAE", choices=sdxl_vaes, value="", allow_custom_value=True)
sdxl_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler a")
sdxl_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
with gr.Column():
with gr.Row():
sdxl_lora1 = gr.Dropdown(label="LoRA1", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sdxl_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
with gr.Row():
sdxl_lora2 = gr.Dropdown(label="LoRA2", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sdxl_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
with gr.Row():
sdxl_lora3 = gr.Dropdown(label="LoRA3", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sdxl_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
with gr.Row():
sdxl_lora4 = gr.Dropdown(label="LoRA4", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sdxl_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
with gr.Row():
sdxl_lora5 = gr.Dropdown(label="LoRA5", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sdxl_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
sdxl_run_button = gr.Button(value="Submit", variant="primary")
with gr.Tab("SD 1.5"):
with gr.Group():
sd15_presets = gr.Radio(label="Presets", choices=list(sd15_preset_dict.keys()), value=list(sd15_preset_dict.keys())[0])
sd15_mtype = gr.Textbox(value="SD 1.5", visible=False)
sd15_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value=DEFAULT_DTYPE)
with gr.Row():
sd15_ema = gr.Checkbox(label="Extract EMA", value=True, visible=True)
sd15_isize = gr.Radio(label="Image size", choices=["768", "512"], value="768")
sd15_sc = gr.Checkbox(label="Safety checker", value=False)
with gr.Accordion("Advanced settings", open=False):
with gr.Row():
sd15_vae = gr.Dropdown(label="VAE", choices=sd15_vaes, value="", allow_custom_value=True)
sd15_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler")
sd15_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
with gr.Column():
with gr.Row():
sd15_lora1 = gr.Dropdown(label="LoRA1", choices=sd15_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd15_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
with gr.Row():
sd15_lora2 = gr.Dropdown(label="LoRA2", choices=sd15_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd15_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
with gr.Row():
sd15_lora3 = gr.Dropdown(label="LoRA3", choices=sd15_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd15_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
with gr.Row():
sd15_lora4 = gr.Dropdown(label="LoRA4", choices=sd15_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd15_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
with gr.Row():
sd15_lora5 = gr.Dropdown(label="LoRA5", choices=sd15_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd15_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
sd15_run_button = gr.Button(value="Submit", variant="primary")
with gr.Tab("FLUX.1"):
with gr.Group():
flux_presets = gr.Radio(label="Presets", choices=list(flux_preset_dict.keys()), value=list(flux_preset_dict.keys())[0])
flux_mtype = gr.Textbox(value="FLUX", visible=False)
flux_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value="bf16")
flux_base_repo = gr.Dropdown(label="Base repo ID", choices=FLUX_BASE_REPOS, value=FLUX_BASE_REPOS[0], allow_custom_value=True, visible=True)
with gr.Accordion("Advanced settings", open=False):
with gr.Row():
flux_vae = gr.Dropdown(label="VAE", choices=flux_vaes, value="", allow_custom_value=True)
flux_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=[""], value="", visible=False)
with gr.Row():
flux_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
flux_t5 = gr.Dropdown(label="T5", choices=t5s, value="", allow_custom_value=True)
with gr.Column():
with gr.Row():
flux_lora1 = gr.Dropdown(label="LoRA1", choices=flux_loras, value="", allow_custom_value=True, min_width=320, scale=2)
flux_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
with gr.Row():
flux_lora2 = gr.Dropdown(label="LoRA2", choices=flux_loras, value="", allow_custom_value=True, min_width=320, scale=2)
flux_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
with gr.Row():
flux_lora3 = gr.Dropdown(label="LoRA3", choices=flux_loras, value="", allow_custom_value=True, min_width=320, scale=2)
flux_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
with gr.Row():
flux_lora4 = gr.Dropdown(label="LoRA4", choices=flux_loras, value="", allow_custom_value=True, min_width=320, scale=2)
flux_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
with gr.Row():
flux_lora5 = gr.Dropdown(label="LoRA5", choices=flux_loras, value="", allow_custom_value=True, min_width=320, scale=2)
flux_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
flux_run_button = gr.Button(value="Submit", variant="primary")
with gr.Tab("SD 3.5"):
with gr.Group():
sd35_presets = gr.Radio(label="Presets", choices=list(sd35_preset_dict.keys()), value=list(sd35_preset_dict.keys())[0])
sd35_mtype = gr.Textbox(value="SD 3.5", visible=False)
sd35_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value="bf16")
sd35_base_repo = gr.Dropdown(label="Base repo ID", choices=SD35_BASE_REPOS, value=SD35_BASE_REPOS[0], allow_custom_value=True, visible=True)
with gr.Accordion("Advanced settings", open=False):
with gr.Row():
sd35_vae = gr.Dropdown(label="VAE", choices=sd35_vaes, value="", allow_custom_value=True)
sd35_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=[""], value="", visible=False)
with gr.Row():
sd35_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
sd35_t5 = gr.Dropdown(label="T5", choices=t5s, value="", allow_custom_value=True)
with gr.Column():
with gr.Row():
sd35_lora1 = gr.Dropdown(label="LoRA1", choices=sd35_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd35_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
with gr.Row():
sd35_lora2 = gr.Dropdown(label="LoRA2", choices=sd35_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd35_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
with gr.Row():
sd35_lora3 = gr.Dropdown(label="LoRA3", choices=sd35_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd35_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
with gr.Row():
sd35_lora4 = gr.Dropdown(label="LoRA4", choices=sd35_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd35_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
with gr.Row():
sd35_lora5 = gr.Dropdown(label="LoRA5", choices=sd35_loras, value="", allow_custom_value=True, min_width=320, scale=2)
sd35_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
sd35_run_button = gr.Button(value="Submit", variant="primary")
adv_args = gr.Textbox(label="Advanced arguments", value="", visible=False)
with gr.Group():
repo_urls = gr.CheckboxGroup(visible=False, choices=[], value=[])
output_md = gr.Markdown(label="Output", value="
", elem_classes="result")
clear_button = gr.Button(value="Clear Output", variant="secondary")
gr.DuplicateButton(value="Duplicate Space")
gr.Markdown("This webui was redesigned with ❤ by [theNeofr](https://huggingface.co/theNeofr)")
gr.on(
triggers=[sdxl_run_button.click],
fn=convert_url_to_diffusers_repo,
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, gated, is_overwrite, is_pr, is_upload_sf, repo_urls,
sdxl_dtype, sdxl_vae, sdxl_clip, flux_t5, sdxl_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, sdxl_mtype,
sdxl_lora1, sdxl_lora1s, sdxl_lora2, sdxl_lora2s, sdxl_lora3, sdxl_lora3s, sdxl_lora4, sdxl_lora4s, sdxl_lora5, sdxl_lora5s, adv_args],
outputs=[repo_urls, output_md],
)
sdxl_presets.change(
fn=sdxl_set_presets,
inputs=[sdxl_presets],
outputs=[sdxl_dtype, sdxl_vae, sdxl_scheduler, sdxl_lora1, sdxl_lora1s, sdxl_lora2, sdxl_lora2s, sdxl_lora3, sdxl_lora3s,
sdxl_lora4, sdxl_lora4s, sdxl_lora5, sdxl_lora5s],
queue=False,
)
gr.on(
triggers=[sd15_run_button.click],
fn=convert_url_to_diffusers_repo,
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, gated, is_overwrite, is_pr, is_upload_sf, repo_urls,
sd15_dtype, sd15_vae, sd15_clip, flux_t5, sd15_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, sd15_mtype,
sd15_lora1, sd15_lora1s, sd15_lora2, sd15_lora2s, sd15_lora3, sd15_lora3s, sd15_lora4, sd15_lora4s, sd15_lora5, sd15_lora5s, adv_args],
outputs=[repo_urls, output_md],
)
sd15_presets.change(
fn=sd15_set_presets,
inputs=[sd15_presets],
outputs=[sd15_dtype, sd15_vae, sd15_scheduler, sd15_lora1, sd15_lora1s, sd15_lora2, sd15_lora2s, sd15_lora3, sd15_lora3s,
sd15_lora4, sd15_lora4s, sd15_lora5, sd15_lora5s, sd15_ema],
queue=False,
)
gr.on(
triggers=[flux_run_button.click],
fn=convert_url_to_diffusers_repo,
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, gated, is_overwrite, is_pr, is_upload_sf, repo_urls,
flux_dtype, flux_vae, flux_clip, flux_t5, flux_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, flux_mtype,
flux_lora1, flux_lora1s, flux_lora2, flux_lora2s, flux_lora3, flux_lora3s, flux_lora4, flux_lora4s, flux_lora5, flux_lora5s, adv_args],
outputs=[repo_urls, output_md],
)
flux_presets.change(
fn=flux_set_presets,
inputs=[flux_presets],
outputs=[flux_dtype, flux_vae, flux_scheduler, flux_lora1, flux_lora1s, flux_lora2, flux_lora2s, flux_lora3, flux_lora3s,
flux_lora4, flux_lora4s, flux_lora5, flux_lora5s, flux_base_repo],
queue=False,
)
gr.on(
triggers=[sd35_run_button.click],
fn=convert_url_to_diffusers_repo,
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, gated, is_overwrite, is_pr, is_upload_sf, repo_urls,
sd35_dtype, sd35_vae, sd35_clip, sd35_t5, sd35_scheduler, sd15_ema, sd15_isize, sd15_sc, sd35_base_repo, sd35_mtype,
sd35_lora1, sd35_lora1s, sd35_lora2, sd35_lora2s, sd35_lora3, sd35_lora3s, sd35_lora4, sd35_lora4s, sd35_lora5, sd35_lora5s, adv_args],
outputs=[repo_urls, output_md],
)
sd35_presets.change(
fn=sd35_set_presets,
inputs=[sd35_presets],
outputs=[sd35_dtype, sd35_vae, sd35_scheduler, sd35_lora1, sd35_lora1s, sd35_lora2, sd35_lora2s, sd35_lora3, sd35_lora3s,
sd35_lora4, sd35_lora4s, sd35_lora5, sd35_lora5s, sd35_base_repo],
queue=False,
)
clear_button.click(lambda: ([], "
"), None, [repo_urls, output_md], queue=False, show_api=False)
demo.queue()
demo.launch(ssr_mode=False)