Spaces:
Running
Running
Better WebUI
Browse files
app.py
CHANGED
@@ -1,249 +1,284 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from convert_url_to_diffusers_multi_gr import convert_url_to_diffusers_repo, get_dtypes, FLUX_BASE_REPOS, SD35_BASE_REPOS
|
3 |
-
from presets import (DEFAULT_DTYPE, schedulers, clips, t5s, sdxl_vaes, sdxl_loras, sdxl_preset_dict, sdxl_set_presets,
|
4 |
-
sd15_vaes, sd15_loras, sd15_preset_dict, sd15_set_presets, flux_vaes, flux_loras, flux_preset_dict, flux_set_presets,
|
5 |
-
sd35_vaes, sd35_loras, sd35_preset_dict, sd35_set_presets)
|
6 |
-
import os
|
7 |
-
|
8 |
-
|
9 |
-
HF_USER = os.getenv("HF_USER", "")
|
10 |
-
HF_REPO = os.getenv("HF_REPO", "")
|
11 |
-
HF_URL = os.getenv("HF_URL", "")
|
12 |
-
HF_OW = os.getenv("HF_OW", False)
|
13 |
-
HF_PR = os.getenv("HF_PR", False)
|
14 |
-
|
15 |
-
css = """
|
16 |
-
.title { font-size: 3em; align-items: center; text-align: center; }
|
17 |
-
.info { align-items: center; text-align: center; }
|
18 |
-
.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; }
|
19 |
-
"""
|
20 |
-
|
21 |
-
with gr.Blocks(theme="
|
22 |
-
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")
|
23 |
-
gr.Markdown(f"""
|
24 |
-
### ⚠️IMPORTANT NOTICE⚠️<br>
|
25 |
-
It's dangerous to expose your access token or key to others.
|
26 |
-
If you do use it, I recommend that you duplicate this space on your own HF account in advance.
|
27 |
-
Keys and tokens could be set to **Secrets** (`HF_TOKEN`, `CIVITAI_API_KEY`) if it's placed in your own space.
|
28 |
-
It saves you the trouble of typing them in.<br>
|
29 |
-
It barely works in the CPU space, but larger files can be converted if duplicated on the more powerful **Zero GPU** space.
|
30 |
-
In particular, conversion of FLUX.1 or SD 3.5 is almost impossible in CPU space.
|
31 |
-
### The steps are the following:
|
32 |
-
1. Paste a write-access token from [hf.co/settings/tokens](https://huggingface.co/settings/tokens).
|
33 |
-
1. Input a model download url of the Hugging Face or Civitai or other sites.
|
34 |
-
1. If you want to download a model from Civitai, paste a Civitai API Key.
|
35 |
-
1. Input your HF user ID. e.g. 'yourid'.
|
36 |
-
1. Input your new repo name. If empty, auto-complete. e.g. 'newrepo'.
|
37 |
-
1. Set the parameters. If not sure, just use the defaults.
|
38 |
-
1. Click "Submit".
|
39 |
-
1. Patiently wait until the output changes. It takes approximately 2 to 3 minutes (on SDXL models downloading from HF).
|
40 |
-
""")
|
41 |
-
with gr.Column():
|
42 |
-
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",
|
43 |
-
value=HF_URL, max_lines=1)
|
44 |
-
with gr.Group():
|
45 |
-
with gr.Row():
|
46 |
-
hf_user = gr.Textbox(label="Your HF user ID", placeholder="username", value=HF_USER, max_lines=1)
|
47 |
-
hf_repo = gr.Textbox(label="New repo name", placeholder="reponame", info="If empty, auto-complete", value=HF_REPO, max_lines=1)
|
48 |
-
with gr.Row(equal_height=True):
|
49 |
-
with gr.Column():
|
50 |
-
hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
|
51 |
-
gr.Markdown("Your token is available at [hf.co/settings/tokens](https://huggingface.co/settings/tokens).", elem_classes="info")
|
52 |
-
with gr.Column():
|
53 |
-
civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
|
54 |
-
gr.Markdown("Your Civitai API key is available at [https://civitai.com/user/account](https://civitai.com/user/account).", elem_classes="info")
|
55 |
-
with gr.Row():
|
56 |
-
is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
|
57 |
-
is_private = gr.Checkbox(label="Create private repo", value=True)
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
with gr.Column():
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
outputs=[
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
outputs=[
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from convert_url_to_diffusers_multi_gr import convert_url_to_diffusers_repo, get_dtypes, FLUX_BASE_REPOS, SD35_BASE_REPOS
|
3 |
+
from presets import (DEFAULT_DTYPE, schedulers, clips, t5s, sdxl_vaes, sdxl_loras, sdxl_preset_dict, sdxl_set_presets,
|
4 |
+
sd15_vaes, sd15_loras, sd15_preset_dict, sd15_set_presets, flux_vaes, flux_loras, flux_preset_dict, flux_set_presets,
|
5 |
+
sd35_vaes, sd35_loras, sd35_preset_dict, sd35_set_presets)
|
6 |
+
import os
|
7 |
+
|
8 |
+
|
9 |
+
HF_USER = os.getenv("HF_USER", "")
|
10 |
+
HF_REPO = os.getenv("HF_REPO", "")
|
11 |
+
HF_URL = os.getenv("HF_URL", "")
|
12 |
+
HF_OW = os.getenv("HF_OW", False)
|
13 |
+
HF_PR = os.getenv("HF_PR", False)
|
14 |
+
|
15 |
+
css = """
|
16 |
+
.title { font-size: 3em; align-items: center; text-align: center; }
|
17 |
+
.info { align-items: center; text-align: center; }
|
18 |
+
.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; }
|
19 |
+
"""
|
20 |
+
|
21 |
+
with gr.Blocks(theme="theNeofr/Syne", fill_width=True, css=css, delete_cache=(60, 3600)) as demo:
|
22 |
+
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")
|
23 |
+
gr.Markdown(f"""
|
24 |
+
### ⚠️IMPORTANT NOTICE⚠️<br>
|
25 |
+
It's dangerous to expose your access token or key to others.
|
26 |
+
If you do use it, I recommend that you duplicate this space on your own HF account in advance.
|
27 |
+
Keys and tokens could be set to **Secrets** (`HF_TOKEN`, `CIVITAI_API_KEY`) if it's placed in your own space.
|
28 |
+
It saves you the trouble of typing them in.<br>
|
29 |
+
It barely works in the CPU space, but larger files can be converted if duplicated on the more powerful **Zero GPU** space.
|
30 |
+
In particular, conversion of FLUX.1 or SD 3.5 is almost impossible in CPU space.
|
31 |
+
### The steps are the following:
|
32 |
+
1. Paste a write-access token from [hf.co/settings/tokens](https://huggingface.co/settings/tokens).
|
33 |
+
1. Input a model download url of the Hugging Face or Civitai or other sites.
|
34 |
+
1. If you want to download a model from Civitai, paste a Civitai API Key.
|
35 |
+
1. Input your HF user ID. e.g. 'yourid'.
|
36 |
+
1. Input your new repo name. If empty, auto-complete. e.g. 'newrepo'.
|
37 |
+
1. Set the parameters. If not sure, just use the defaults.
|
38 |
+
1. Click "Submit".
|
39 |
+
1. Patiently wait until the output changes. It takes approximately 2 to 3 minutes (on SDXL models downloading from HF).
|
40 |
+
""")
|
41 |
+
with gr.Column():
|
42 |
+
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",
|
43 |
+
value=HF_URL, max_lines=1)
|
44 |
+
with gr.Group():
|
45 |
+
with gr.Row():
|
46 |
+
hf_user = gr.Textbox(label="Your HF user ID", placeholder="username", value=HF_USER, max_lines=1)
|
47 |
+
hf_repo = gr.Textbox(label="New repo name", placeholder="reponame", info="If empty, auto-complete", value=HF_REPO, max_lines=1)
|
48 |
+
with gr.Row(equal_height=True):
|
49 |
+
with gr.Column():
|
50 |
+
hf_token = gr.Textbox(label="Your HF write token", placeholder="hf_...", value="", max_lines=1)
|
51 |
+
gr.Markdown("Your token is available at [hf.co/settings/tokens](https://huggingface.co/settings/tokens).", elem_classes="info")
|
52 |
+
with gr.Column():
|
53 |
+
civitai_key = gr.Textbox(label="Your Civitai API Key (Optional)", info="If you download model from Civitai...", placeholder="", value="", max_lines=1)
|
54 |
+
gr.Markdown("Your Civitai API key is available at [https://civitai.com/user/account](https://civitai.com/user/account).", elem_classes="info")
|
55 |
+
with gr.Row():
|
56 |
+
is_upload_sf = gr.Checkbox(label="Upload single safetensors file into new repo", value=False)
|
57 |
+
is_private = gr.Checkbox(label="Create private repo", value=True)
|
58 |
+
with gr.Row():
|
59 |
+
is_overwrite = gr.Checkbox(label="Overwrite repo", value=HF_OW)
|
60 |
+
is_pr = gr.Checkbox(label="Create PR", value=HF_PR)
|
61 |
+
with gr.Tab("SDXL"):
|
62 |
+
with gr.Group():
|
63 |
+
sdxl_presets = gr.Radio(label="Presets", choices=list(sdxl_preset_dict.keys()), value=list(sdxl_preset_dict.keys())[0])
|
64 |
+
sdxl_mtype = gr.Textbox(value="SDXL", visible=False)
|
65 |
+
with gr.Row():
|
66 |
+
sdxl_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value=DEFAULT_DTYPE)
|
67 |
+
with gr.Accordion("Advanced settings", open=False):
|
68 |
+
with gr.Row():
|
69 |
+
sdxl_vae = gr.Dropdown(label="VAE", choices=sdxl_vaes, value="", allow_custom_value=True)
|
70 |
+
sdxl_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
|
71 |
+
sdxl_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler a")
|
72 |
+
with gr.Row():
|
73 |
+
with gr.Column():
|
74 |
+
with gr.Row():
|
75 |
+
sdxl_lora1 = gr.Dropdown(label="LoRA1", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320)
|
76 |
+
sdxl_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
|
77 |
+
with gr.Column():
|
78 |
+
with gr.Row():
|
79 |
+
sdxl_lora2 = gr.Dropdown(label="LoRA2", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320)
|
80 |
+
sdxl_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
|
81 |
+
with gr.Column():
|
82 |
+
with gr.Row():
|
83 |
+
sdxl_lora3 = gr.Dropdown(label="LoRA3", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320)
|
84 |
+
sdxl_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
|
85 |
+
with gr.Column():
|
86 |
+
with gr.Row():
|
87 |
+
sdxl_lora4 = gr.Dropdown(label="LoRA4", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320)
|
88 |
+
sdxl_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
|
89 |
+
with gr.Column():
|
90 |
+
with gr.Row():
|
91 |
+
sdxl_lora5 = gr.Dropdown(label="LoRA5", choices=sdxl_loras, value="", allow_custom_value=True, min_width=320)
|
92 |
+
sdxl_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
|
93 |
+
sdxl_run_button = gr.Button(value="Submit", variant="primary")
|
94 |
+
with gr.Tab("SD 1.5"):
|
95 |
+
with gr.Group():
|
96 |
+
with gr.Row():
|
97 |
+
sd15_presets = gr.Radio(label="Presets", choices=list(sd15_preset_dict.keys()), value=list(sd15_preset_dict.keys())[0])
|
98 |
+
with gr.Row():
|
99 |
+
sd15_mtype = gr.Textbox(value="SD 1.5", visible=False)
|
100 |
+
with gr.Row():
|
101 |
+
sd15_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value=DEFAULT_DTYPE)
|
102 |
+
with gr.Row():
|
103 |
+
sd15_ema = gr.Checkbox(label="Extract EMA", value=True, visible=True)
|
104 |
+
with gr.Row():
|
105 |
+
sd15_isize = gr.Radio(label="Image size", choices=["768", "512"], value="768")
|
106 |
+
with gr.Row():
|
107 |
+
sd15_sc = gr.Checkbox(label="Safety checker", value=False)
|
108 |
+
with gr.Accordion("Advanced settings", open=False):
|
109 |
+
with gr.Row():
|
110 |
+
sd15_vae = gr.Dropdown(label="VAE", choices=sd15_vaes, value="", allow_custom_value=True)
|
111 |
+
with gr.Row():
|
112 |
+
sd15_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
|
113 |
+
with gr.Row():
|
114 |
+
sd15_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=schedulers, value="Euler")
|
115 |
+
with gr.Row():
|
116 |
+
with gr.Column():
|
117 |
+
with gr.Row():
|
118 |
+
sd15_lora1 = gr.Dropdown(label="LoRA1", choices=sd15_loras, value="", allow_custom_value=True, min_width=320)
|
119 |
+
with gr.Row():
|
120 |
+
sd15_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
|
121 |
+
with gr.Row():
|
122 |
+
with gr.Column():
|
123 |
+
sd15_lora2 = gr.Dropdown(label="LoRA2", choices=sd15_loras, value="", allow_custom_value=True, min_width=320)
|
124 |
+
with gr.Row():
|
125 |
+
sd15_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
|
126 |
+
with gr.Column():
|
127 |
+
with gr.Row():
|
128 |
+
sd15_lora3 = gr.Dropdown(label="LoRA3", choices=sd15_loras, value="", allow_custom_value=True, min_width=320)
|
129 |
+
with gr.Row():
|
130 |
+
sd15_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
|
131 |
+
|
132 |
+
with gr.Column():
|
133 |
+
with gr.Row():
|
134 |
+
sd15_lora4 = gr.Dropdown(label="LoRA4", choices=sd15_loras, value="", allow_custom_value=True, min_width=320)
|
135 |
+
with gr.Row():
|
136 |
+
sd15_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
|
137 |
+
with gr.Column():
|
138 |
+
with gr.Row():
|
139 |
+
sd15_lora5 = gr.Dropdown(label="LoRA5", choices=sd15_loras, value="", allow_custom_value=True, min_width=320)
|
140 |
+
with gr.Row():
|
141 |
+
sd15_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
|
142 |
+
sd15_run_button = gr.Button(value="Submit", variant="primary")
|
143 |
+
with gr.Tab("FLUX.1"):
|
144 |
+
with gr.Group():
|
145 |
+
flux_presets = gr.Radio(label="Presets", choices=list(flux_preset_dict.keys()), value=list(flux_preset_dict.keys())[0])
|
146 |
+
flux_mtype = gr.Textbox(value="FLUX", visible=False)
|
147 |
+
with gr.Row():
|
148 |
+
flux_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value="bf16")
|
149 |
+
flux_base_repo = gr.Dropdown(label="Base repo ID", choices=FLUX_BASE_REPOS, value=FLUX_BASE_REPOS[0], allow_custom_value=True, visible=True)
|
150 |
+
with gr.Accordion("Advanced settings", open=False):
|
151 |
+
with gr.Row():
|
152 |
+
flux_vae = gr.Dropdown(label="VAE", choices=flux_vaes, value="", allow_custom_value=True)
|
153 |
+
with gr.Row():
|
154 |
+
flux_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
|
155 |
+
with gr.Row():
|
156 |
+
flux_t5 = gr.Dropdown(label="T5", choices=t5s, value="", allow_custom_value=True)
|
157 |
+
flux_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=[""], value="", visible=False)
|
158 |
+
with gr.Row():
|
159 |
+
with gr.Column():
|
160 |
+
flux_lora1 = gr.Dropdown(label="LoRA1", choices=flux_loras, value="", allow_custom_value=True, min_width=320)
|
161 |
+
flux_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
|
162 |
+
with gr.Column():
|
163 |
+
flux_lora2 = gr.Dropdown(label="LoRA2", choices=flux_loras, value="", allow_custom_value=True, min_width=320)
|
164 |
+
flux_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
|
165 |
+
with gr.Column():
|
166 |
+
flux_lora3 = gr.Dropdown(label="LoRA3", choices=flux_loras, value="", allow_custom_value=True, min_width=320)
|
167 |
+
flux_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
|
168 |
+
with gr.Column():
|
169 |
+
flux_lora4 = gr.Dropdown(label="LoRA4", choices=flux_loras, value="", allow_custom_value=True, min_width=320)
|
170 |
+
flux_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
|
171 |
+
with gr.Column():
|
172 |
+
flux_lora5 = gr.Dropdown(label="LoRA5", choices=flux_loras, value="", allow_custom_value=True, min_width=320)
|
173 |
+
flux_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
|
174 |
+
flux_run_button = gr.Button(value="Submit", variant="primary")
|
175 |
+
with gr.Tab("SD 3.5"):
|
176 |
+
with gr.Group():
|
177 |
+
with gr.Row():
|
178 |
+
sd35_presets = gr.Radio(label="Presets", choices=list(sd35_preset_dict.keys()), value=list(sd35_preset_dict.keys())[0])
|
179 |
+
with gr.Row():
|
180 |
+
sd35_mtype = gr.Textbox(value="SD 3.5", visible=False)
|
181 |
+
with gr.Row():
|
182 |
+
sd35_dtype = gr.Radio(label="Output data type", choices=get_dtypes(), value="bf16")
|
183 |
+
sd35_base_repo = gr.Dropdown(label="Base repo ID", choices=SD35_BASE_REPOS, value=SD35_BASE_REPOS[0], allow_custom_value=True, visible=True)
|
184 |
+
with gr.Accordion("Advanced settings", open=False):
|
185 |
+
with gr.Row():
|
186 |
+
sd35_vae = gr.Dropdown(label="VAE", choices=sd35_vaes, value="", allow_custom_value=True)
|
187 |
+
sd35_clip = gr.Dropdown(label="CLIP", choices=clips, value="", allow_custom_value=True)
|
188 |
+
sd35_t5 = gr.Dropdown(label="T5", choices=t5s, value="", allow_custom_value=True)
|
189 |
+
sd35_scheduler = gr.Dropdown(label="Scheduler (Sampler)", choices=[""], value="", visible=False)
|
190 |
+
with gr.Row():
|
191 |
+
with gr.Column():
|
192 |
+
with gr.Row():
|
193 |
+
sd35_lora1 = gr.Dropdown(label="LoRA1", choices=sd35_loras, value="", allow_custom_value=True, min_width=320)
|
194 |
+
sd35_lora1s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA1 weight scale")
|
195 |
+
with gr.Column():
|
196 |
+
with gr.Row():
|
197 |
+
sd35_lora2 = gr.Dropdown(label="LoRA2", choices=sd35_loras, value="", allow_custom_value=True, min_width=320)
|
198 |
+
sd35_lora2s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA2 weight scale")
|
199 |
+
with gr.Column():
|
200 |
+
with gr.Row():
|
201 |
+
sd35_lora3 = gr.Dropdown(label="LoRA3", choices=sd35_loras, value="", allow_custom_value=True, min_width=320)
|
202 |
+
sd35_lora3s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA3 weight scale")
|
203 |
+
with gr.Column():
|
204 |
+
with gr.Row():
|
205 |
+
sd35_lora4 = gr.Dropdown(label="LoRA4", choices=sd35_loras, value="", allow_custom_value=True, min_width=320)
|
206 |
+
sd35_lora4s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA4 weight scale")
|
207 |
+
with gr.Column():
|
208 |
+
with gr.Row():
|
209 |
+
sd35_lora5 = gr.Dropdown(label="LoRA5", choices=sd35_loras, value="", allow_custom_value=True, min_width=320)
|
210 |
+
sd35_lora5s = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA5 weight scale")
|
211 |
+
sd35_run_button = gr.Button(value="Submit", variant="primary")
|
212 |
+
adv_args = gr.Textbox(label="Advanced arguments", value="", visible=False)
|
213 |
+
with gr.Group():
|
214 |
+
with gr.Row():
|
215 |
+
repo_urls = gr.CheckboxGroup(visible=False, choices=[], value=[])
|
216 |
+
output_md = gr.Markdown(label="Output", value="<br><br>", elem_classes="result")
|
217 |
+
clear_button = gr.Button(value="Clear Output", variant="secondary")
|
218 |
+
gr.DuplicateButton(value="Duplicate Space")
|
219 |
+
|
220 |
+
gr.Markdown("This webui was redesigned with ❤ by [theNeofr](https://huggingface.co/theNeofr)")
|
221 |
+
gr.on(
|
222 |
+
triggers=[sdxl_run_button.click],
|
223 |
+
fn=convert_url_to_diffusers_repo,
|
224 |
+
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, is_overwrite, is_pr, is_upload_sf, repo_urls,
|
225 |
+
sdxl_dtype, sdxl_vae, sdxl_clip, flux_t5, sdxl_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, sdxl_mtype,
|
226 |
+
sdxl_lora1, sdxl_lora1s, sdxl_lora2, sdxl_lora2s, sdxl_lora3, sdxl_lora3s, sdxl_lora4, sdxl_lora4s, sdxl_lora5, sdxl_lora5s, adv_args],
|
227 |
+
outputs=[repo_urls, output_md],
|
228 |
+
)
|
229 |
+
sdxl_presets.change(
|
230 |
+
fn=sdxl_set_presets,
|
231 |
+
inputs=[sdxl_presets],
|
232 |
+
outputs=[sdxl_dtype, sdxl_vae, sdxl_scheduler, sdxl_lora1, sdxl_lora1s, sdxl_lora2, sdxl_lora2s, sdxl_lora3, sdxl_lora3s,
|
233 |
+
sdxl_lora4, sdxl_lora4s, sdxl_lora5, sdxl_lora5s],
|
234 |
+
queue=False,
|
235 |
+
)
|
236 |
+
gr.on(
|
237 |
+
triggers=[sd15_run_button.click],
|
238 |
+
fn=convert_url_to_diffusers_repo,
|
239 |
+
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, is_overwrite, is_pr, is_upload_sf, repo_urls,
|
240 |
+
sd15_dtype, sd15_vae, sd15_clip, flux_t5, sd15_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, sd15_mtype,
|
241 |
+
sd15_lora1, sd15_lora1s, sd15_lora2, sd15_lora2s, sd15_lora3, sd15_lora3s, sd15_lora4, sd15_lora4s, sd15_lora5, sd15_lora5s, adv_args],
|
242 |
+
outputs=[repo_urls, output_md],
|
243 |
+
)
|
244 |
+
sd15_presets.change(
|
245 |
+
fn=sd15_set_presets,
|
246 |
+
inputs=[sd15_presets],
|
247 |
+
outputs=[sd15_dtype, sd15_vae, sd15_scheduler, sd15_lora1, sd15_lora1s, sd15_lora2, sd15_lora2s, sd15_lora3, sd15_lora3s,
|
248 |
+
sd15_lora4, sd15_lora4s, sd15_lora5, sd15_lora5s, sd15_ema],
|
249 |
+
queue=False,
|
250 |
+
)
|
251 |
+
gr.on(
|
252 |
+
triggers=[flux_run_button.click],
|
253 |
+
fn=convert_url_to_diffusers_repo,
|
254 |
+
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, is_overwrite, is_pr, is_upload_sf, repo_urls,
|
255 |
+
flux_dtype, flux_vae, flux_clip, flux_t5, flux_scheduler, sd15_ema, sd15_isize, sd15_sc, flux_base_repo, flux_mtype,
|
256 |
+
flux_lora1, flux_lora1s, flux_lora2, flux_lora2s, flux_lora3, flux_lora3s, flux_lora4, flux_lora4s, flux_lora5, flux_lora5s, adv_args],
|
257 |
+
outputs=[repo_urls, output_md],
|
258 |
+
)
|
259 |
+
flux_presets.change(
|
260 |
+
fn=flux_set_presets,
|
261 |
+
inputs=[flux_presets],
|
262 |
+
outputs=[flux_dtype, flux_vae, flux_scheduler, flux_lora1, flux_lora1s, flux_lora2, flux_lora2s, flux_lora3, flux_lora3s,
|
263 |
+
flux_lora4, flux_lora4s, flux_lora5, flux_lora5s, flux_base_repo],
|
264 |
+
queue=False,
|
265 |
+
)
|
266 |
+
gr.on(
|
267 |
+
triggers=[sd35_run_button.click],
|
268 |
+
fn=convert_url_to_diffusers_repo,
|
269 |
+
inputs=[dl_url, hf_user, hf_repo, hf_token, civitai_key, is_private, is_overwrite, is_pr, is_upload_sf, repo_urls,
|
270 |
+
sd35_dtype, sd35_vae, sd35_clip, sd35_t5, sd35_scheduler, sd15_ema, sd15_isize, sd15_sc, sd35_base_repo, sd35_mtype,
|
271 |
+
sd35_lora1, sd35_lora1s, sd35_lora2, sd35_lora2s, sd35_lora3, sd35_lora3s, sd35_lora4, sd35_lora4s, sd35_lora5, sd35_lora5s, adv_args],
|
272 |
+
outputs=[repo_urls, output_md],
|
273 |
+
)
|
274 |
+
sd35_presets.change(
|
275 |
+
fn=sd35_set_presets,
|
276 |
+
inputs=[sd35_presets],
|
277 |
+
outputs=[sd35_dtype, sd35_vae, sd35_scheduler, sd35_lora1, sd35_lora1s, sd35_lora2, sd35_lora2s, sd35_lora3, sd35_lora3s,
|
278 |
+
sd35_lora4, sd35_lora4s, sd35_lora5, sd35_lora5s, sd35_base_repo],
|
279 |
+
queue=False,
|
280 |
+
)
|
281 |
+
clear_button.click(lambda: ([], "<br><br>"), None, [repo_urls, output_md], queue=False, show_api=False)
|
282 |
+
|
283 |
+
demo.queue()
|
284 |
+
demo.launch()
|