John6666 commited on
Commit
8b5139d
·
verified ·
1 Parent(s): 9365383

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +36 -23
  2. env.py +23 -5
app.py CHANGED
@@ -67,14 +67,28 @@ preprocessor_controlnet = {
67
  "None",
68
  ],
69
  "canny": [
70
- "Canny"
 
71
  ],
72
  "mlsd": [
73
- "MLSD"
 
74
  ],
75
  "ip2p": [
76
  "ip2p"
77
  ],
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
  task_stablepy = {
@@ -95,11 +109,12 @@ task_stablepy = {
95
  'depth ControlNet': 'depth',
96
  'normalbae ControlNet': 'normalbae',
97
  'lineart ControlNet': 'lineart',
98
- # 'lineart_anime ControlNet': 'lineart_anime',
99
  'shuffle ControlNet': 'shuffle',
100
  'ip2p ControlNet': 'ip2p',
101
  'optical pattern ControlNet': 'pattern',
102
- 'tile realistic': 'sdxl_tile_realistic',
 
103
  }
104
 
105
  task_model_list = list(task_stablepy.keys())
@@ -122,7 +137,7 @@ def download_things(directory, url, hf_token="", civitai_api_key=""):
122
  if hf_token:
123
  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]}")
124
  else:
125
- 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]}")
126
  elif "civitai.com" in url:
127
  if "?" in url:
128
  url = url.split("?")[0]
@@ -137,7 +152,7 @@ def download_things(directory, url, hf_token="", civitai_api_key=""):
137
 
138
  def get_model_list(directory_path):
139
  model_list = []
140
- valid_extensions = {'.ckpt' , '.pt', '.pth', '.safetensors', '.bin'}
141
 
142
  for filename in os.listdir(directory_path):
143
  if os.path.splitext(filename)[1] in valid_extensions:
@@ -149,18 +164,6 @@ def get_model_list(directory_path):
149
  return model_list
150
 
151
 
152
- def process_string(input_string):
153
- parts = input_string.split('/')
154
-
155
- if len(parts) == 2:
156
- first_element = parts[1]
157
- complete_string = input_string
158
- result = (first_element, complete_string)
159
- return result
160
- else:
161
- return None
162
-
163
-
164
  ## BEGIN MOD
165
  from modutils import (list_uniq, download_private_repo, get_model_id_list, get_tupled_embed_list,
166
  get_lora_model_list, get_all_lora_tupled_list, update_loras, apply_lora_prompt, set_prompt_loras,
@@ -224,9 +227,15 @@ def get_embed_list(pipeline_name):
224
  print('\033[33m🏁 Download and listing of valid models completed.\033[0m')
225
 
226
  upscaler_dict_gui = {
227
- None : None,
228
- "Lanczos" : "Lanczos",
229
- "Nearest" : "Nearest",
 
 
 
 
 
 
230
  "RealESRGAN_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
231
  "RealESRNet_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
232
  "RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
@@ -243,6 +252,7 @@ upscaler_dict_gui = {
243
  "NickelbackFS4x" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
244
  }
245
 
 
246
 
247
  def extract_parameters(input_string):
248
  parameters = {}
@@ -487,6 +497,7 @@ class GuiSD:
487
  model_ip2,
488
  mode_ip2,
489
  scale_ip2,
 
490
  #progress=gr.Progress(track_tqdm=True),
491
  ):
492
  #progress(0, desc="Preparing inference...")
@@ -574,7 +585,7 @@ class GuiSD:
574
  if task == "inpaint" and not image_mask:
575
  raise ValueError("No mask image found: Specify one in 'Image Mask'")
576
 
577
- if upscaler_model_path in [None, "Lanczos", "Nearest"]:
578
  upscaler_model = upscaler_model_path
579
  else:
580
  directory_upscalers = 'upscalers'
@@ -640,6 +651,7 @@ class GuiSD:
640
  "num_steps": steps,
641
  "guidance_scale": cfg,
642
  "clip_skip": clip_skip,
 
643
  "seed": seed,
644
  "image": image_control,
645
  "preprocessor_name": preprocessor_name,
@@ -874,6 +886,7 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', elem_id="main", fill_width=True, cs
874
  cfg_gui = gr.Slider(minimum=0, maximum=30, step=0.5, value=7.0, label="CFG")
875
  with gr.Row():
876
  seed_gui = gr.Number(minimum=-1, maximum=9999999999, value=-1, label="Seed")
 
877
  num_images_gui = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Images")
878
  clip_skip_gui = gr.Checkbox(value=False, label="Layer 2 Clip Skip")
879
  free_u_gui = gr.Checkbox(value=False, label="FreeU")
@@ -1015,7 +1028,6 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', elem_id="main", fill_width=True, cs
1015
 
1016
  with gr.Column() as menu_advanced:
1017
  with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
1018
- upscaler_keys = list(upscaler_dict_gui.keys())
1019
  upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=upscaler_dict_gui[upscaler_keys[0]])
1020
  with gr.Row():
1021
  upscaler_increases_size_gui = gr.Slider(minimum=1.1, maximum=6., step=0.1, value=1.0, label="Upscale by")
@@ -1557,6 +1569,7 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', elem_id="main", fill_width=True, cs
1557
  model_ip2,
1558
  mode_ip2,
1559
  scale_ip2,
 
1560
  ],
1561
  outputs=[result_images, actual_task_info],
1562
  queue=True,
 
67
  "None",
68
  ],
69
  "canny": [
70
+ "Canny",
71
+ "None",
72
  ],
73
  "mlsd": [
74
+ "MLSD",
75
+ "None",
76
  ],
77
  "ip2p": [
78
  "ip2p"
79
  ],
80
+ "recolor": [
81
+ "Recolor luminance",
82
+ "Recolor intensity",
83
+ "None",
84
+ ],
85
+ "tile": [
86
+ "Mild Blur",
87
+ "Moderate Blur",
88
+ "Heavy Blur",
89
+ "None",
90
+ ],
91
+
92
  }
93
 
94
  task_stablepy = {
 
109
  'depth ControlNet': 'depth',
110
  'normalbae ControlNet': 'normalbae',
111
  'lineart ControlNet': 'lineart',
112
+ 'lineart_anime ControlNet': 'lineart_anime',
113
  'shuffle ControlNet': 'shuffle',
114
  'ip2p ControlNet': 'ip2p',
115
  'optical pattern ControlNet': 'pattern',
116
+ 'recolor ControlNet': 'recolor',
117
+ 'tile ControlNet': 'tile',
118
  }
119
 
120
  task_model_list = list(task_stablepy.keys())
 
137
  if hf_token:
138
  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]}")
139
  else:
140
+ 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]}")
141
  elif "civitai.com" in url:
142
  if "?" in url:
143
  url = url.split("?")[0]
 
152
 
153
  def get_model_list(directory_path):
154
  model_list = []
155
+ valid_extensions = {'.ckpt', '.pt', '.pth', '.safetensors', '.bin'}
156
 
157
  for filename in os.listdir(directory_path):
158
  if os.path.splitext(filename)[1] in valid_extensions:
 
164
  return model_list
165
 
166
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  ## BEGIN MOD
168
  from modutils import (list_uniq, download_private_repo, get_model_id_list, get_tupled_embed_list,
169
  get_lora_model_list, get_all_lora_tupled_list, update_loras, apply_lora_prompt, set_prompt_loras,
 
227
  print('\033[33m🏁 Download and listing of valid models completed.\033[0m')
228
 
229
  upscaler_dict_gui = {
230
+ None: None,
231
+ "Lanczos": "Lanczos",
232
+ "Nearest": "Nearest",
233
+ 'Latent': 'Latent',
234
+ 'Latent (antialiased)': 'Latent (antialiased)',
235
+ 'Latent (bicubic)': 'Latent (bicubic)',
236
+ 'Latent (bicubic antialiased)': 'Latent (bicubic antialiased)',
237
+ 'Latent (nearest)': 'Latent (nearest)',
238
+ 'Latent (nearest-exact)': 'Latent (nearest-exact)',
239
  "RealESRGAN_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
240
  "RealESRNet_x4plus" : "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
241
  "RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
 
252
  "NickelbackFS4x" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
253
  }
254
 
255
+ upscaler_keys = list(upscaler_dict_gui.keys())
256
 
257
  def extract_parameters(input_string):
258
  parameters = {}
 
497
  model_ip2,
498
  mode_ip2,
499
  scale_ip2,
500
+ pag_scale,
501
  #progress=gr.Progress(track_tqdm=True),
502
  ):
503
  #progress(0, desc="Preparing inference...")
 
585
  if task == "inpaint" and not image_mask:
586
  raise ValueError("No mask image found: Specify one in 'Image Mask'")
587
 
588
+ if upscaler_model_path in upscaler_keys[:9]:
589
  upscaler_model = upscaler_model_path
590
  else:
591
  directory_upscalers = 'upscalers'
 
651
  "num_steps": steps,
652
  "guidance_scale": cfg,
653
  "clip_skip": clip_skip,
654
+ "pag_scale": float(pag_scale),
655
  "seed": seed,
656
  "image": image_control,
657
  "preprocessor_name": preprocessor_name,
 
886
  cfg_gui = gr.Slider(minimum=0, maximum=30, step=0.5, value=7.0, label="CFG")
887
  with gr.Row():
888
  seed_gui = gr.Number(minimum=-1, maximum=9999999999, value=-1, label="Seed")
889
+ pag_scale_gui = gr.Slider(minimum=0.0, maximum=10.0, step=0.1, value=0.0, label="PAG Scale")
890
  num_images_gui = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Images")
891
  clip_skip_gui = gr.Checkbox(value=False, label="Layer 2 Clip Skip")
892
  free_u_gui = gr.Checkbox(value=False, label="FreeU")
 
1028
 
1029
  with gr.Column() as menu_advanced:
1030
  with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
 
1031
  upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=upscaler_dict_gui[upscaler_keys[0]])
1032
  with gr.Row():
1033
  upscaler_increases_size_gui = gr.Slider(minimum=1.1, maximum=6., step=0.1, value=1.0, label="Upscale by")
 
1569
  model_ip2,
1570
  mode_ip2,
1571
  scale_ip2,
1572
+ pag_scale_gui,
1573
  ],
1574
  outputs=[result_images, actual_task_info],
1575
  queue=True,
env.py CHANGED
@@ -8,20 +8,31 @@ hf_read_token = os.environ.get('HF_READ_TOKEN') # only use for private repo
8
  load_diffusers_format_model = [
9
  'stabilityai/stable-diffusion-xl-base-1.0',
10
  'cagliostrolab/animagine-xl-3.1',
 
11
  'misri/epicrealismXL_v7FinalDestination',
12
  'misri/juggernautXL_juggernautX',
13
  'misri/zavychromaxl_v80',
14
  'SG161222/RealVisXL_V4.0',
 
15
  'misri/newrealityxlAllInOne_Newreality40',
16
  'eienmojiki/Anything-XL',
17
  'eienmojiki/Starry-XL-v5.2',
18
  'gsdf/CounterfeitXL',
19
  'kitty7779/ponyDiffusionV6XL',
 
 
 
20
  'John6666/ebara-mfcg-pony-mix-v12-sdxl',
21
  'John6666/t-ponynai3-v51-sdxl',
22
- 'yodayo-ai/clandestine-xl-1.0',
 
 
 
 
23
  'yodayo-ai/kivotos-xl-2.0',
24
  'yodayo-ai/holodayo-xl-2.1',
 
 
25
  'digiplay/majicMIX_sombre_v2',
26
  'digiplay/majicMIX_realistic_v6',
27
  'digiplay/majicMIX_realistic_v7',
@@ -30,18 +41,25 @@ load_diffusers_format_model = [
30
  'digiplay/DarkSushi2.5D_v1',
31
  'digiplay/darkphoenix3D_v1.1',
32
  'digiplay/BeenYouLiteL11_diffusers',
33
- 'rubbrband/revAnimated_v2Rebirth',
34
  'youknownothing/cyberrealistic_v50',
 
 
 
 
 
35
  'votepurchase/counterfeitV30_v30',
 
36
  'Meina/MeinaMix_V11',
37
  'Meina/MeinaUnreal_V5',
38
  'Meina/MeinaPastel_V7',
39
- 'rubbrband/realcartoon3d_v16',
40
- 'rubbrband/realcartoonRealistic_v14',
 
41
  'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
42
  'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
43
  'KBlueLeaf/Kohaku-XL-Zeta',
44
- 'kayfahaarukku/UrangDiffusion-1.3',
45
  'Eugeoter/artiwaifu-diffusion-2.0',
46
  'Raelina/Rae-Diffusion-XL-V2',
47
  'Raelina/Raemu-XL-V4',
 
8
  load_diffusers_format_model = [
9
  'stabilityai/stable-diffusion-xl-base-1.0',
10
  'cagliostrolab/animagine-xl-3.1',
11
+ 'John6666/epicrealism-xl-v8kiss-sdxl',
12
  'misri/epicrealismXL_v7FinalDestination',
13
  'misri/juggernautXL_juggernautX',
14
  'misri/zavychromaxl_v80',
15
  'SG161222/RealVisXL_V4.0',
16
+ 'SG161222/RealVisXL_V5.0',
17
  'misri/newrealityxlAllInOne_Newreality40',
18
  'eienmojiki/Anything-XL',
19
  'eienmojiki/Starry-XL-v5.2',
20
  'gsdf/CounterfeitXL',
21
  'kitty7779/ponyDiffusionV6XL',
22
+ 'WhiteAiZ/autismmixSDXL_autismmixConfetti_diffusers',
23
+ 'GraydientPlatformAPI/aniverse-pony',
24
+ 'John6666/mistoon-anime-ponyalpha-sdxl',
25
  'John6666/ebara-mfcg-pony-mix-v12-sdxl',
26
  'John6666/t-ponynai3-v51-sdxl',
27
+ 'John6666/mala-anime-mix-nsfw-pony-xl-v5-sdxl',
28
+ 'John6666/wai-real-mix-v11-sdxl',
29
+ 'John6666/cyberrealistic-pony-v63-sdxl',
30
+ 'GraydientPlatformAPI/realcartoon-pony-diffusion',
31
+ 'John6666/nova-anime-xl-pony-v5-sdxl',
32
  'yodayo-ai/kivotos-xl-2.0',
33
  'yodayo-ai/holodayo-xl-2.1',
34
+ 'yodayo-ai/clandestine-xl-1.0',
35
+ 'John6666/silvermoon-mix-01xl-v11-sdxl',
36
  'digiplay/majicMIX_sombre_v2',
37
  'digiplay/majicMIX_realistic_v6',
38
  'digiplay/majicMIX_realistic_v7',
 
41
  'digiplay/DarkSushi2.5D_v1',
42
  'digiplay/darkphoenix3D_v1.1',
43
  'digiplay/BeenYouLiteL11_diffusers',
44
+ 'Yntec/RevAnimatedV2Rebirth',
45
  'youknownothing/cyberrealistic_v50',
46
+ 'youknownothing/deliberate-v6',
47
+ 'GraydientPlatformAPI/deliberate-cyber3',
48
+ 'GraydientPlatformAPI/picx-real',
49
+ 'GraydientPlatformAPI/perfectworld6',
50
+ 'emilianJR/epiCRealism',
51
  'votepurchase/counterfeitV30_v30',
52
+ 'votepurchase/ChilloutMix',
53
  'Meina/MeinaMix_V11',
54
  'Meina/MeinaUnreal_V5',
55
  'Meina/MeinaPastel_V7',
56
+ 'GraydientPlatformAPI/realcartoon3d-17',
57
+ 'GraydientPlatformAPI/realcartoon-pixar11',
58
+ 'GraydientPlatformAPI/realcartoon-real17',
59
  'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
60
  'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
61
  'KBlueLeaf/Kohaku-XL-Zeta',
62
+ 'kayfahaarukku/UrangDiffusion-1.4',
63
  'Eugeoter/artiwaifu-diffusion-2.0',
64
  'Raelina/Rae-Diffusion-XL-V2',
65
  'Raelina/Raemu-XL-V4',