Spaces:
Running
on
Zero
Running
on
Zero
Upload 2 files
Browse files
dc.py
CHANGED
@@ -91,14 +91,27 @@ preprocessor_controlnet = {
|
|
91 |
"None",
|
92 |
],
|
93 |
"canny": [
|
94 |
-
"Canny"
|
|
|
95 |
],
|
96 |
"mlsd": [
|
97 |
-
"MLSD"
|
|
|
98 |
],
|
99 |
"ip2p": [
|
100 |
"ip2p"
|
101 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
task_stablepy = {
|
@@ -119,16 +132,16 @@ task_stablepy = {
|
|
119 |
'depth ControlNet': 'depth',
|
120 |
'normalbae ControlNet': 'normalbae',
|
121 |
'lineart ControlNet': 'lineart',
|
122 |
-
|
123 |
'shuffle ControlNet': 'shuffle',
|
124 |
'ip2p ControlNet': 'ip2p',
|
125 |
'optical pattern ControlNet': 'pattern',
|
126 |
-
'
|
|
|
127 |
}
|
128 |
|
129 |
task_model_list = list(task_stablepy.keys())
|
130 |
|
131 |
-
|
132 |
def download_things(directory, url, hf_token="", civitai_api_key=""):
|
133 |
url = url.strip()
|
134 |
|
@@ -146,7 +159,7 @@ def download_things(directory, url, hf_token="", civitai_api_key=""):
|
|
146 |
if hf_token:
|
147 |
os.system(f"aria2c --console-log-level=error --summary-interval=10 --header={user_header} -c -x 16 -k 1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
|
148 |
else:
|
149 |
-
os.system
|
150 |
elif "civitai.com" in url:
|
151 |
if "?" in url:
|
152 |
url = url.split("?")[0]
|
@@ -161,7 +174,7 @@ def download_things(directory, url, hf_token="", civitai_api_key=""):
|
|
161 |
|
162 |
def get_model_list(directory_path):
|
163 |
model_list = []
|
164 |
-
valid_extensions = {'.ckpt'
|
165 |
|
166 |
for filename in os.listdir(directory_path):
|
167 |
if os.path.splitext(filename)[1] in valid_extensions:
|
@@ -173,17 +186,6 @@ def get_model_list(directory_path):
|
|
173 |
return model_list
|
174 |
|
175 |
|
176 |
-
def process_string(input_string):
|
177 |
-
parts = input_string.split('/')
|
178 |
-
|
179 |
-
if len(parts) == 2:
|
180 |
-
first_element = parts[1]
|
181 |
-
complete_string = input_string
|
182 |
-
result = (first_element, complete_string)
|
183 |
-
return result
|
184 |
-
else:
|
185 |
-
return None
|
186 |
-
|
187 |
## BEGIN MOD
|
188 |
from modutils import (to_list, list_uniq, list_sub, get_model_id_list, get_tupled_embed_list,
|
189 |
get_tupled_model_list, get_lora_model_list, download_private_repo)
|
@@ -242,9 +244,15 @@ def get_embed_list(pipeline_name):
|
|
242 |
print('\033[33m🏁 Download and listing of valid models completed.\033[0m')
|
243 |
|
244 |
upscaler_dict_gui = {
|
245 |
-
None
|
246 |
-
"Lanczos"
|
247 |
-
"Nearest"
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
"RealESRGAN_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
|
249 |
"RealESRNet_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
|
250 |
"RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
@@ -261,6 +269,8 @@ upscaler_dict_gui = {
|
|
261 |
"NickelbackFS4x" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
|
262 |
}
|
263 |
|
|
|
|
|
264 |
|
265 |
def extract_parameters(input_string):
|
266 |
parameters = {}
|
@@ -459,6 +469,7 @@ class GuiSD:
|
|
459 |
model_ip2,
|
460 |
mode_ip2,
|
461 |
scale_ip2,
|
|
|
462 |
progress=gr.Progress(track_tqdm=True),
|
463 |
):
|
464 |
progress(0, desc="Preparing inference...")
|
@@ -542,7 +553,7 @@ class GuiSD:
|
|
542 |
if task == "inpaint" and not image_mask:
|
543 |
raise ValueError("No mask image found: Specify one in 'Image Mask'")
|
544 |
|
545 |
-
if upscaler_model_path in [
|
546 |
upscaler_model = upscaler_model_path
|
547 |
else:
|
548 |
directory_upscalers = 'upscalers'
|
@@ -608,6 +619,7 @@ class GuiSD:
|
|
608 |
"num_steps": steps,
|
609 |
"guidance_scale": cfg,
|
610 |
"clip_skip": clip_skip,
|
|
|
611 |
"seed": seed,
|
612 |
"image": image_control,
|
613 |
"preprocessor_name": preprocessor_name,
|
@@ -738,7 +750,7 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
738 |
False, True, 1, True, False, False, False, False, "./images", False, False, False, True, 1, 0.55,
|
739 |
False, False, False, True, False, "Use same sampler", False, "", "", 0.35, True, True, False, 4, 4, 32,
|
740 |
False, "", "", 0.35, True, True, False, 4, 4, 32,
|
741 |
-
True, None, None, "plus_face", "original", 0.7, None, None, "base", "style", 0.7, progress
|
742 |
)
|
743 |
|
744 |
progress(1, desc="Inference completed.")
|
|
|
91 |
"None",
|
92 |
],
|
93 |
"canny": [
|
94 |
+
"Canny",
|
95 |
+
"None",
|
96 |
],
|
97 |
"mlsd": [
|
98 |
+
"MLSD",
|
99 |
+
"None",
|
100 |
],
|
101 |
"ip2p": [
|
102 |
"ip2p"
|
103 |
],
|
104 |
+
"recolor": [
|
105 |
+
"Recolor luminance",
|
106 |
+
"Recolor intensity",
|
107 |
+
"None",
|
108 |
+
],
|
109 |
+
"tile": [
|
110 |
+
"Mild Blur",
|
111 |
+
"Moderate Blur",
|
112 |
+
"Heavy Blur",
|
113 |
+
"None",
|
114 |
+
],
|
115 |
}
|
116 |
|
117 |
task_stablepy = {
|
|
|
132 |
'depth ControlNet': 'depth',
|
133 |
'normalbae ControlNet': 'normalbae',
|
134 |
'lineart ControlNet': 'lineart',
|
135 |
+
'lineart_anime ControlNet': 'lineart_anime',
|
136 |
'shuffle ControlNet': 'shuffle',
|
137 |
'ip2p ControlNet': 'ip2p',
|
138 |
'optical pattern ControlNet': 'pattern',
|
139 |
+
'recolor ControlNet': 'recolor',
|
140 |
+
'tile ControlNet': 'tile',
|
141 |
}
|
142 |
|
143 |
task_model_list = list(task_stablepy.keys())
|
144 |
|
|
|
145 |
def download_things(directory, url, hf_token="", civitai_api_key=""):
|
146 |
url = url.strip()
|
147 |
|
|
|
159 |
if hf_token:
|
160 |
os.system(f"aria2c --console-log-level=error --summary-interval=10 --header={user_header} -c -x 16 -k 1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
|
161 |
else:
|
162 |
+
os.system(f"aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -x 16 -k 1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
|
163 |
elif "civitai.com" in url:
|
164 |
if "?" in url:
|
165 |
url = url.split("?")[0]
|
|
|
174 |
|
175 |
def get_model_list(directory_path):
|
176 |
model_list = []
|
177 |
+
valid_extensions = {'.ckpt', '.pt', '.pth', '.safetensors', '.bin'}
|
178 |
|
179 |
for filename in os.listdir(directory_path):
|
180 |
if os.path.splitext(filename)[1] in valid_extensions:
|
|
|
186 |
return model_list
|
187 |
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
## BEGIN MOD
|
190 |
from modutils import (to_list, list_uniq, list_sub, get_model_id_list, get_tupled_embed_list,
|
191 |
get_tupled_model_list, get_lora_model_list, download_private_repo)
|
|
|
244 |
print('\033[33m🏁 Download and listing of valid models completed.\033[0m')
|
245 |
|
246 |
upscaler_dict_gui = {
|
247 |
+
None: None,
|
248 |
+
"Lanczos": "Lanczos",
|
249 |
+
"Nearest": "Nearest",
|
250 |
+
'Latent': 'Latent',
|
251 |
+
'Latent (antialiased)': 'Latent (antialiased)',
|
252 |
+
'Latent (bicubic)': 'Latent (bicubic)',
|
253 |
+
'Latent (bicubic antialiased)': 'Latent (bicubic antialiased)',
|
254 |
+
'Latent (nearest)': 'Latent (nearest)',
|
255 |
+
'Latent (nearest-exact)': 'Latent (nearest-exact)',
|
256 |
"RealESRGAN_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
|
257 |
"RealESRNet_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
|
258 |
"RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
|
|
269 |
"NickelbackFS4x" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
|
270 |
}
|
271 |
|
272 |
+
upscaler_keys = list(upscaler_dict_gui.keys())
|
273 |
+
|
274 |
|
275 |
def extract_parameters(input_string):
|
276 |
parameters = {}
|
|
|
469 |
model_ip2,
|
470 |
mode_ip2,
|
471 |
scale_ip2,
|
472 |
+
pag_scale,
|
473 |
progress=gr.Progress(track_tqdm=True),
|
474 |
):
|
475 |
progress(0, desc="Preparing inference...")
|
|
|
553 |
if task == "inpaint" and not image_mask:
|
554 |
raise ValueError("No mask image found: Specify one in 'Image Mask'")
|
555 |
|
556 |
+
if upscaler_model_path in upscaler_keys[:9]:
|
557 |
upscaler_model = upscaler_model_path
|
558 |
else:
|
559 |
directory_upscalers = 'upscalers'
|
|
|
619 |
"num_steps": steps,
|
620 |
"guidance_scale": cfg,
|
621 |
"clip_skip": clip_skip,
|
622 |
+
"pag_scale": float(pag_scale),
|
623 |
"seed": seed,
|
624 |
"image": image_control,
|
625 |
"preprocessor_name": preprocessor_name,
|
|
|
750 |
False, True, 1, True, False, False, False, False, "./images", False, False, False, True, 1, 0.55,
|
751 |
False, False, False, True, False, "Use same sampler", False, "", "", 0.35, True, True, False, 4, 4, 32,
|
752 |
False, "", "", 0.35, True, True, False, 4, 4, 32,
|
753 |
+
True, None, None, "plus_face", "original", 0.7, None, None, "base", "style", 0.7, 0.0, progress
|
754 |
)
|
755 |
|
756 |
progress(1, desc="Inference completed.")
|
env.py
CHANGED
@@ -40,18 +40,31 @@ load_diffusers_format_model = [
|
|
40 |
'votepurchase/ponyRealism_v21MainVAE',
|
41 |
'stabilityai/stable-diffusion-xl-base-1.0',
|
42 |
'cagliostrolab/animagine-xl-3.1',
|
|
|
43 |
'misri/epicrealismXL_v7FinalDestination',
|
44 |
'misri/juggernautXL_juggernautX',
|
45 |
'misri/zavychromaxl_v80',
|
46 |
'SG161222/RealVisXL_V4.0',
|
|
|
47 |
'misri/newrealityxlAllInOne_Newreality40',
|
48 |
'eienmojiki/Anything-XL',
|
49 |
'eienmojiki/Starry-XL-v5.2',
|
50 |
'gsdf/CounterfeitXL',
|
51 |
'kitty7779/ponyDiffusionV6XL',
|
52 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
'yodayo-ai/kivotos-xl-2.0',
|
54 |
'yodayo-ai/holodayo-xl-2.1',
|
|
|
|
|
55 |
'digiplay/majicMIX_sombre_v2',
|
56 |
'digiplay/majicMIX_realistic_v6',
|
57 |
'digiplay/majicMIX_realistic_v7',
|
@@ -60,18 +73,23 @@ load_diffusers_format_model = [
|
|
60 |
'digiplay/DarkSushi2.5D_v1',
|
61 |
'digiplay/darkphoenix3D_v1.1',
|
62 |
'digiplay/BeenYouLiteL11_diffusers',
|
63 |
-
'
|
64 |
'youknownothing/cyberrealistic_v50',
|
65 |
-
'
|
|
|
|
|
|
|
|
|
66 |
'Meina/MeinaMix_V11',
|
67 |
'Meina/MeinaUnreal_V5',
|
68 |
'Meina/MeinaPastel_V7',
|
69 |
-
'
|
70 |
-
'
|
|
|
71 |
'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
|
72 |
'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
|
73 |
'KBlueLeaf/Kohaku-XL-Zeta',
|
74 |
-
'kayfahaarukku/UrangDiffusion-1.
|
75 |
'Eugeoter/artiwaifu-diffusion-2.0',
|
76 |
'Raelina/Rae-Diffusion-XL-V2',
|
77 |
'Raelina/Raemu-XL-V4',
|
|
|
40 |
'votepurchase/ponyRealism_v21MainVAE',
|
41 |
'stabilityai/stable-diffusion-xl-base-1.0',
|
42 |
'cagliostrolab/animagine-xl-3.1',
|
43 |
+
'John6666/epicrealism-xl-v8kiss-sdxl',
|
44 |
'misri/epicrealismXL_v7FinalDestination',
|
45 |
'misri/juggernautXL_juggernautX',
|
46 |
'misri/zavychromaxl_v80',
|
47 |
'SG161222/RealVisXL_V4.0',
|
48 |
+
'SG161222/RealVisXL_V5.0',
|
49 |
'misri/newrealityxlAllInOne_Newreality40',
|
50 |
'eienmojiki/Anything-XL',
|
51 |
'eienmojiki/Starry-XL-v5.2',
|
52 |
'gsdf/CounterfeitXL',
|
53 |
'kitty7779/ponyDiffusionV6XL',
|
54 |
+
'WhiteAiZ/autismmixSDXL_autismmixConfetti_diffusers',
|
55 |
+
'GraydientPlatformAPI/aniverse-pony',
|
56 |
+
'John6666/mistoon-anime-ponyalpha-sdxl',
|
57 |
+
'John6666/ebara-mfcg-pony-mix-v12-sdxl',
|
58 |
+
'John6666/t-ponynai3-v51-sdxl',
|
59 |
+
'John6666/mala-anime-mix-nsfw-pony-xl-v5-sdxl',
|
60 |
+
'John6666/wai-real-mix-v11-sdxl',
|
61 |
+
'John6666/cyberrealistic-pony-v63-sdxl',
|
62 |
+
'GraydientPlatformAPI/realcartoon-pony-diffusion',
|
63 |
+
'John6666/nova-anime-xl-pony-v5-sdxl',
|
64 |
'yodayo-ai/kivotos-xl-2.0',
|
65 |
'yodayo-ai/holodayo-xl-2.1',
|
66 |
+
'yodayo-ai/clandestine-xl-1.0',
|
67 |
+
'John6666/silvermoon-mix-01xl-v11-sdxl',
|
68 |
'digiplay/majicMIX_sombre_v2',
|
69 |
'digiplay/majicMIX_realistic_v6',
|
70 |
'digiplay/majicMIX_realistic_v7',
|
|
|
73 |
'digiplay/DarkSushi2.5D_v1',
|
74 |
'digiplay/darkphoenix3D_v1.1',
|
75 |
'digiplay/BeenYouLiteL11_diffusers',
|
76 |
+
'Yntec/RevAnimatedV2Rebirth',
|
77 |
'youknownothing/cyberrealistic_v50',
|
78 |
+
'youknownothing/deliberate-v6',
|
79 |
+
'GraydientPlatformAPI/deliberate-cyber3',
|
80 |
+
'GraydientPlatformAPI/picx-real',
|
81 |
+
'GraydientPlatformAPI/perfectworld6',
|
82 |
+
'emilianJR/epiCRealism',
|
83 |
'Meina/MeinaMix_V11',
|
84 |
'Meina/MeinaUnreal_V5',
|
85 |
'Meina/MeinaPastel_V7',
|
86 |
+
'GraydientPlatformAPI/realcartoon3d-17',
|
87 |
+
'GraydientPlatformAPI/realcartoon-pixar11',
|
88 |
+
'GraydientPlatformAPI/realcartoon-real17',
|
89 |
'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
|
90 |
'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
|
91 |
'KBlueLeaf/Kohaku-XL-Zeta',
|
92 |
+
'kayfahaarukku/UrangDiffusion-1.4',
|
93 |
'Eugeoter/artiwaifu-diffusion-2.0',
|
94 |
'Raelina/Rae-Diffusion-XL-V2',
|
95 |
'Raelina/Raemu-XL-V4',
|