Upload 6 files
Browse files- README.md +12 -12
- app.py +36 -22
- convert_url_to_diffusers_sdxl.py +1 -1
- convert_url_to_diffusers_sdxl_gr.py +1 -1
- local/convert_url_to_diffusers_sdxl.py +1 -1
README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Download and Convert SDXL To Diffusers V2
|
| 3 |
-
emoji: 🎨➡️🧨
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Download and Convert SDXL To Diffusers V2
|
| 3 |
+
emoji: 🎨➡️🧨
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.0.2
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -46,10 +46,14 @@ def set_presets(preset: str="Default"):
|
|
| 46 |
return p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]
|
| 47 |
|
| 48 |
|
| 49 |
-
css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
|
| 52 |
-
gr.Markdown("# Download and convert any Stable Diffusion XL safetensors to Diffusers and create your repo")
|
| 53 |
gr.Markdown(
|
| 54 |
f"""
|
| 55 |
- [A CLI version of this tool (without uploading-related function) is available here](https://huggingface.co/spaces/John6666/sdxl-to-diffusers-v2/tree/main/local).
|
|
@@ -73,30 +77,40 @@ It saves you the trouble of typing them in.<br>
|
|
| 73 |
)
|
| 74 |
with gr.Column():
|
| 75 |
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="", max_lines=1)
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
| 82 |
presets = gr.Radio(label="Presets", choices=list(preset_dict.keys()), value="Default")
|
| 83 |
with gr.Accordion("Advanced settings", open=False):
|
| 84 |
is_half = gr.Checkbox(label="Half precision", value=True)
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
run_button = gr.Button(value="Submit")
|
| 98 |
repo_urls = gr.CheckboxGroup(visible=False, choices=[], value=None)
|
| 99 |
-
output_md = gr.Markdown(label="Output")
|
| 100 |
gr.DuplicateButton(value="Duplicate Space")
|
| 101 |
|
| 102 |
gr.on(
|
|
|
|
| 46 |
return p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]
|
| 47 |
|
| 48 |
|
| 49 |
+
css = """
|
| 50 |
+
.title { font-size: 3em; align-items: center; text-align: center; }
|
| 51 |
+
.info { align-items: center; text-align: center; }
|
| 52 |
+
.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; }
|
| 53 |
+
"""
|
| 54 |
|
| 55 |
+
with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css, delete_cache=(60, 3600)) as demo:
|
| 56 |
+
gr.Markdown("# Download and convert any Stable Diffusion XL safetensors to Diffusers and create your repo", elem_classes="title")
|
| 57 |
gr.Markdown(
|
| 58 |
f"""
|
| 59 |
- [A CLI version of this tool (without uploading-related function) is available here](https://huggingface.co/spaces/John6666/sdxl-to-diffusers-v2/tree/main/local).
|
|
|
|
| 77 |
)
|
| 78 |
with gr.Column():
|
| 79 |
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="", max_lines=1)
|
| 80 |
+
with gr.Row():
|
| 81 |
+
hf_user = gr.Textbox(label="Your HF user ID", placeholder="username", value="", max_lines=1)
|
| 82 |
+
hf_repo = gr.Textbox(label="New repo name", placeholder="reponame", info="If empty, auto-complete", value="", max_lines=1)
|
| 83 |
+
with gr.Row():
|
| 84 |
+
hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
|
| 85 |
+
civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
|
| 86 |
+
with gr.Row():
|
| 87 |
+
is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
|
| 88 |
+
is_private = gr.Checkbox(label="Create private repo", value=True)
|
| 89 |
presets = gr.Radio(label="Presets", choices=list(preset_dict.keys()), value="Default")
|
| 90 |
with gr.Accordion("Advanced settings", open=False):
|
| 91 |
is_half = gr.Checkbox(label="Half precision", value=True)
|
| 92 |
+
with gr.Row():
|
| 93 |
+
vae = gr.Dropdown(label="VAE", choices=vaes, value="", allow_custom_value=True)
|
| 94 |
+
scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler a")
|
| 95 |
+
with gr.Row():
|
| 96 |
+
with gr.Column():
|
| 97 |
+
lora1 = gr.Dropdown(label="LoRA1", choices=loras, value="", allow_custom_value=True, min_width=320)
|
| 98 |
+
lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
|
| 99 |
+
with gr.Column():
|
| 100 |
+
lora2 = gr.Dropdown(label="LoRA2", choices=loras, value="", allow_custom_value=True, min_width=320)
|
| 101 |
+
lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
|
| 102 |
+
with gr.Column():
|
| 103 |
+
lora3 = gr.Dropdown(label="LoRA3", choices=loras, value="", allow_custom_value=True, min_width=320)
|
| 104 |
+
lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
|
| 105 |
+
with gr.Column():
|
| 106 |
+
lora4 = gr.Dropdown(label="LoRA4", choices=loras, value="", allow_custom_value=True, min_width=320)
|
| 107 |
+
lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
|
| 108 |
+
with gr.Column():
|
| 109 |
+
lora5 = gr.Dropdown(label="LoRA5", choices=loras, value="", allow_custom_value=True, min_width=320)
|
| 110 |
+
lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
|
| 111 |
run_button = gr.Button(value="Submit")
|
| 112 |
repo_urls = gr.CheckboxGroup(visible=False, choices=[], value=None)
|
| 113 |
+
output_md = gr.Markdown(label="Output", value="<br><br>", elem_classes="result")
|
| 114 |
gr.DuplicateButton(value="Duplicate Space")
|
| 115 |
|
| 116 |
gr.on(
|
convert_url_to_diffusers_sdxl.py
CHANGED
|
@@ -194,7 +194,7 @@ tags:
|
|
| 194 |
|
| 195 |
|
| 196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
| 197 |
-
if not lora_dict or not isinstance(lora_dict, dict): return
|
| 198 |
a_list = []
|
| 199 |
w_list = []
|
| 200 |
for k, v in lora_dict.items():
|
|
|
|
| 194 |
|
| 195 |
|
| 196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
| 197 |
+
if not lora_dict or not isinstance(lora_dict, dict): return pipe
|
| 198 |
a_list = []
|
| 199 |
w_list = []
|
| 200 |
for k, v in lora_dict.items():
|
convert_url_to_diffusers_sdxl_gr.py
CHANGED
|
@@ -223,7 +223,7 @@ tags:
|
|
| 223 |
|
| 224 |
|
| 225 |
def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key="", hf_token=""):
|
| 226 |
-
if not lora_dict or not isinstance(lora_dict, dict): return
|
| 227 |
a_list = []
|
| 228 |
w_list = []
|
| 229 |
for k, v in lora_dict.items():
|
|
|
|
| 223 |
|
| 224 |
|
| 225 |
def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key="", hf_token=""):
|
| 226 |
+
if not lora_dict or not isinstance(lora_dict, dict): return pipe
|
| 227 |
a_list = []
|
| 228 |
w_list = []
|
| 229 |
for k, v in lora_dict.items():
|
local/convert_url_to_diffusers_sdxl.py
CHANGED
|
@@ -194,7 +194,7 @@ tags:
|
|
| 194 |
|
| 195 |
|
| 196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
| 197 |
-
if not lora_dict or not isinstance(lora_dict, dict): return
|
| 198 |
a_list = []
|
| 199 |
w_list = []
|
| 200 |
for k, v in lora_dict.items():
|
|
|
|
| 194 |
|
| 195 |
|
| 196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
| 197 |
+
if not lora_dict or not isinstance(lora_dict, dict): return pipe
|
| 198 |
a_list = []
|
| 199 |
w_list = []
|
| 200 |
for k, v in lora_dict.items():
|