Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,13 @@ preprocessor_controlnet = {
|
|
61 |
"None",
|
62 |
"None (anime)",
|
63 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
"shuffle": [
|
65 |
"ContentShuffle",
|
66 |
"None",
|
@@ -190,8 +197,9 @@ load_diffusers_format_model = [
|
|
190 |
'eienmojiki/Starry-XL-v5.2',
|
191 |
'gsdf/CounterfeitXL',
|
192 |
'KBlueLeaf/Kohaku-XL-Zeta',
|
193 |
-
'
|
194 |
'WhiteAiZ/autismmixSDXL_autismmixConfetti_diffusers',
|
|
|
195 |
'GraydientPlatformAPI/aniverse-pony',
|
196 |
'John6666/mistoon-anime-ponyalpha-sdxl',
|
197 |
'John6666/ebara-mfcg-pony-mix-v12-sdxl',
|
@@ -201,10 +209,10 @@ load_diffusers_format_model = [
|
|
201 |
'John6666/cyberrealistic-pony-v63-sdxl',
|
202 |
'GraydientPlatformAPI/realcartoon-pony-diffusion',
|
203 |
'John6666/nova-anime-xl-pony-v5-sdxl',
|
|
|
204 |
'yodayo-ai/kivotos-xl-2.0',
|
205 |
'yodayo-ai/holodayo-xl-2.1',
|
206 |
'yodayo-ai/clandestine-xl-1.0',
|
207 |
-
'John6666/silvermoon-mix-01xl-v11-sdxl',
|
208 |
'digiplay/majicMIX_sombre_v2',
|
209 |
'digiplay/majicMIX_realistic_v6',
|
210 |
'digiplay/majicMIX_realistic_v7',
|
@@ -266,6 +274,7 @@ lora_model_list.insert(0, "None")
|
|
266 |
vae_model_list = get_model_list(directory_vaes)
|
267 |
vae_model_list.insert(0, "None")
|
268 |
|
|
|
269 |
def get_my_lora(link_url):
|
270 |
for url in [url.strip() for url in link_url.split(',')]:
|
271 |
if not os.path.exists(f"./loras/{url.split('/')[-1]}"):
|
@@ -298,20 +307,20 @@ upscaler_dict_gui = {
|
|
298 |
'Latent (bicubic antialiased)': 'Latent (bicubic antialiased)',
|
299 |
'Latent (nearest)': 'Latent (nearest)',
|
300 |
'Latent (nearest-exact)': 'Latent (nearest-exact)',
|
301 |
-
"RealESRGAN_x4plus"
|
302 |
-
"RealESRNet_x4plus"
|
303 |
"RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
304 |
"RealESRGAN_x2plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth",
|
305 |
"realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
|
306 |
"realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
|
307 |
-
"realesr-general-wdn-x4v3"
|
308 |
"4x-UltraSharp" : "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
|
309 |
-
"4x_foolhardy_Remacri"
|
310 |
-
"Remacri4xExtraSmoother"
|
311 |
-
"AnimeSharp4x"
|
312 |
"lollypop" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/lollypop.pth",
|
313 |
-
"RealisticRescaler4x"
|
314 |
-
"NickelbackFS4x"
|
315 |
}
|
316 |
|
317 |
upscaler_keys = list(upscaler_dict_gui.keys())
|
@@ -376,6 +385,7 @@ warnings.filterwarnings(action="ignore", category=FutureWarning, module="transfo
|
|
376 |
from stablepy import logger
|
377 |
logger.setLevel(logging.DEBUG)
|
378 |
|
|
|
379 |
def info_html(json_data, title, subtitle):
|
380 |
return f"""
|
381 |
<div style='padding: 0; border-radius: 10px;'>
|
@@ -387,6 +397,7 @@ def info_html(json_data, title, subtitle):
|
|
387 |
</div>
|
388 |
"""
|
389 |
|
|
|
390 |
class GuiSD:
|
391 |
def __init__(self, stream=True):
|
392 |
self.model = None
|
@@ -590,10 +601,8 @@ class GuiSD:
|
|
590 |
model_precision = torch.float16
|
591 |
self.model.device = torch.device("cuda:0")
|
592 |
if not self.model:
|
593 |
-
from modelstream import Model_Diffusers2
|
594 |
-
|
595 |
print("Loading model...")
|
596 |
-
self.model =
|
597 |
base_model_id=model_name,
|
598 |
task_name=task,
|
599 |
vae_model=vae_model if vae_model != "None" else None,
|
@@ -760,6 +769,14 @@ class GuiSD:
|
|
760 |
|
761 |
info_state = info_state + "<br>" + "GENERATION DATA:<br>" + "<br>-------<br>".join(metadata).replace("\n", "<br>")
|
762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
yield img, info_state
|
764 |
|
765 |
|
@@ -808,7 +825,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
808 |
clear_prompt_gui = gr.Button(value="🗑️")
|
809 |
set_random_seed = gr.Button(value="🎲")
|
810 |
generate_button = gr.Button(value="GENERATE", variant="primary")
|
811 |
-
|
812 |
model_name_gui.change(
|
813 |
update_task_options,
|
814 |
[model_name_gui, task_gui],
|
@@ -816,7 +833,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
816 |
)
|
817 |
|
818 |
load_model_gui = gr.HTML()
|
819 |
-
|
820 |
result_images = gr.Gallery(
|
821 |
label="Generated images",
|
822 |
show_label=False,
|
@@ -922,7 +939,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
922 |
("Classic-ignore", "Classic-ignore"),
|
923 |
("None", "None"),
|
924 |
]
|
925 |
-
prompt_syntax_gui = gr.Dropdown(label="Prompt Syntax", choices=prompt_s_options, value=prompt_s_options[
|
926 |
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list)
|
927 |
|
928 |
with gr.Accordion("Hires fix", open=False, visible=True):
|
@@ -938,19 +955,26 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
938 |
hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
|
939 |
|
940 |
with gr.Accordion("LoRA", open=False, visible=True):
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
|
952 |
with gr.Accordion("From URL", open=False, visible=True):
|
953 |
-
text_lora = gr.Textbox(label="URL", placeholder="
|
954 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
955 |
button_lora.click(
|
956 |
get_my_lora,
|
@@ -958,7 +982,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
958 |
[lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui]
|
959 |
)
|
960 |
|
961 |
-
with gr.Accordion("IP-Adapter", open=False, visible=True)
|
962 |
|
963 |
IP_MODELS = sorted(list(set(IP_ADAPTERS_SD + IP_ADAPTERS_SDXL)))
|
964 |
MODE_IP_OPTIONS = ["original", "style", "layout", "style+layout"]
|
@@ -1094,7 +1118,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1094 |
leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
|
1095 |
disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
|
1096 |
display_images_gui = gr.Checkbox(value=True, label="Display Images")
|
1097 |
-
save_generated_images_gui = gr.Checkbox(value=
|
1098 |
image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
|
1099 |
retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
|
1100 |
retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
|
@@ -1619,4 +1643,5 @@ app.queue()
|
|
1619 |
app.launch(
|
1620 |
show_error=True,
|
1621 |
debug=True,
|
|
|
1622 |
)
|
|
|
61 |
"None",
|
62 |
"None (anime)",
|
63 |
],
|
64 |
+
"lineart_anime": [
|
65 |
+
"Lineart",
|
66 |
+
"Lineart coarse",
|
67 |
+
"Lineart (anime)",
|
68 |
+
"None",
|
69 |
+
"None (anime)",
|
70 |
+
],
|
71 |
"shuffle": [
|
72 |
"ContentShuffle",
|
73 |
"None",
|
|
|
197 |
'eienmojiki/Starry-XL-v5.2',
|
198 |
'gsdf/CounterfeitXL',
|
199 |
'KBlueLeaf/Kohaku-XL-Zeta',
|
200 |
+
'John6666/silvermoon-mix-01xl-v11-sdxl',
|
201 |
'WhiteAiZ/autismmixSDXL_autismmixConfetti_diffusers',
|
202 |
+
'kitty7779/ponyDiffusionV6XL',
|
203 |
'GraydientPlatformAPI/aniverse-pony',
|
204 |
'John6666/mistoon-anime-ponyalpha-sdxl',
|
205 |
'John6666/ebara-mfcg-pony-mix-v12-sdxl',
|
|
|
209 |
'John6666/cyberrealistic-pony-v63-sdxl',
|
210 |
'GraydientPlatformAPI/realcartoon-pony-diffusion',
|
211 |
'John6666/nova-anime-xl-pony-v5-sdxl',
|
212 |
+
'John6666/autismmix-sdxl-autismmix-pony-sdxl',
|
213 |
'yodayo-ai/kivotos-xl-2.0',
|
214 |
'yodayo-ai/holodayo-xl-2.1',
|
215 |
'yodayo-ai/clandestine-xl-1.0',
|
|
|
216 |
'digiplay/majicMIX_sombre_v2',
|
217 |
'digiplay/majicMIX_realistic_v6',
|
218 |
'digiplay/majicMIX_realistic_v7',
|
|
|
274 |
vae_model_list = get_model_list(directory_vaes)
|
275 |
vae_model_list.insert(0, "None")
|
276 |
|
277 |
+
|
278 |
def get_my_lora(link_url):
|
279 |
for url in [url.strip() for url in link_url.split(',')]:
|
280 |
if not os.path.exists(f"./loras/{url.split('/')[-1]}"):
|
|
|
307 |
'Latent (bicubic antialiased)': 'Latent (bicubic antialiased)',
|
308 |
'Latent (nearest)': 'Latent (nearest)',
|
309 |
'Latent (nearest-exact)': 'Latent (nearest-exact)',
|
310 |
+
"RealESRGAN_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
|
311 |
+
"RealESRNet_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
|
312 |
"RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
313 |
"RealESRGAN_x2plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth",
|
314 |
"realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
|
315 |
"realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
|
316 |
+
"realesr-general-wdn-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
|
317 |
"4x-UltraSharp" : "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
|
318 |
+
"4x_foolhardy_Remacri": "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
|
319 |
+
"Remacri4xExtraSmoother": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/Remacri%204x%20ExtraSmoother.pth",
|
320 |
+
"AnimeSharp4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/AnimeSharp%204x.pth",
|
321 |
"lollypop" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/lollypop.pth",
|
322 |
+
"RealisticRescaler4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/RealisticRescaler%204x.pth",
|
323 |
+
"NickelbackFS4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
|
324 |
}
|
325 |
|
326 |
upscaler_keys = list(upscaler_dict_gui.keys())
|
|
|
385 |
from stablepy import logger
|
386 |
logger.setLevel(logging.DEBUG)
|
387 |
|
388 |
+
|
389 |
def info_html(json_data, title, subtitle):
|
390 |
return f"""
|
391 |
<div style='padding: 0; border-radius: 10px;'>
|
|
|
397 |
</div>
|
398 |
"""
|
399 |
|
400 |
+
|
401 |
class GuiSD:
|
402 |
def __init__(self, stream=True):
|
403 |
self.model = None
|
|
|
601 |
model_precision = torch.float16
|
602 |
self.model.device = torch.device("cuda:0")
|
603 |
if not self.model:
|
|
|
|
|
604 |
print("Loading model...")
|
605 |
+
self.model = Model_Diffusers(
|
606 |
base_model_id=model_name,
|
607 |
task_name=task,
|
608 |
vae_model=vae_model if vae_model != "None" else None,
|
|
|
769 |
|
770 |
info_state = info_state + "<br>" + "GENERATION DATA:<br>" + "<br>-------<br>".join(metadata).replace("\n", "<br>")
|
771 |
|
772 |
+
download_links = "<br>".join(
|
773 |
+
[
|
774 |
+
f'<a href="{path.replace("/images/", "/file=/home/user/app/images/")}" download="{os.path.basename(path)}">Download Image {i + 1}</a>'
|
775 |
+
for i, path in enumerate(image_path)
|
776 |
+
]
|
777 |
+
)
|
778 |
+
info_state += f"<br>{download_links}"
|
779 |
+
|
780 |
yield img, info_state
|
781 |
|
782 |
|
|
|
825 |
clear_prompt_gui = gr.Button(value="🗑️")
|
826 |
set_random_seed = gr.Button(value="🎲")
|
827 |
generate_button = gr.Button(value="GENERATE", variant="primary")
|
828 |
+
|
829 |
model_name_gui.change(
|
830 |
update_task_options,
|
831 |
[model_name_gui, task_gui],
|
|
|
833 |
)
|
834 |
|
835 |
load_model_gui = gr.HTML()
|
836 |
+
|
837 |
result_images = gr.Gallery(
|
838 |
label="Generated images",
|
839 |
show_label=False,
|
|
|
939 |
("Classic-ignore", "Classic-ignore"),
|
940 |
("None", "None"),
|
941 |
]
|
942 |
+
prompt_syntax_gui = gr.Dropdown(label="Prompt Syntax", choices=prompt_s_options, value=prompt_s_options[1][1])
|
943 |
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list)
|
944 |
|
945 |
with gr.Accordion("Hires fix", open=False, visible=True):
|
|
|
955 |
hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
|
956 |
|
957 |
with gr.Accordion("LoRA", open=False, visible=True):
|
958 |
+
|
959 |
+
def lora_dropdown(label):
|
960 |
+
return gr.Dropdown(label=label, choices=lora_model_list, allow_custom_value=True)
|
961 |
+
|
962 |
+
def lora_scale_slider(label):
|
963 |
+
return gr.Slider(minimum=-2, maximum=2, step=0.01, value=0.33, label=label)
|
964 |
+
|
965 |
+
lora1_gui = lora_dropdown("Lora1")
|
966 |
+
lora_scale_1_gui = lora_scale_slider("Lora Scale 1")
|
967 |
+
lora2_gui = lora_dropdown("Lora2")
|
968 |
+
lora_scale_2_gui = lora_scale_slider("Lora Scale 2")
|
969 |
+
lora3_gui = lora_dropdown("Lora3")
|
970 |
+
lora_scale_3_gui = lora_scale_slider("Lora Scale 3")
|
971 |
+
lora4_gui = lora_dropdown("Lora4")
|
972 |
+
lora_scale_4_gui = lora_scale_slider("Lora Scale 4")
|
973 |
+
lora5_gui = lora_dropdown("Lora5")
|
974 |
+
lora_scale_5_gui = lora_scale_slider("Lora Scale 5")
|
975 |
|
976 |
with gr.Accordion("From URL", open=False, visible=True):
|
977 |
+
text_lora = gr.Textbox(label="LoRA URL", placeholder="https://civitai.com/api/download/models/28907", lines=1)
|
978 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
979 |
button_lora.click(
|
980 |
get_my_lora,
|
|
|
982 |
[lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui]
|
983 |
)
|
984 |
|
985 |
+
with gr.Accordion("IP-Adapter", open=False, visible=True):
|
986 |
|
987 |
IP_MODELS = sorted(list(set(IP_ADAPTERS_SD + IP_ADAPTERS_SDXL)))
|
988 |
MODE_IP_OPTIONS = ["original", "style", "layout", "style+layout"]
|
|
|
1118 |
leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
|
1119 |
disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
|
1120 |
display_images_gui = gr.Checkbox(value=True, label="Display Images")
|
1121 |
+
save_generated_images_gui = gr.Checkbox(value=True, label="Save Generated Images")
|
1122 |
image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
|
1123 |
retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
|
1124 |
retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
|
|
|
1643 |
app.launch(
|
1644 |
show_error=True,
|
1645 |
debug=True,
|
1646 |
+
allowed_paths=["./images/"],
|
1647 |
)
|