Spaces:
Running
on
Zero
Running
on
Zero
Upload 5 files
Browse files- app.py +480 -473
- modutils.py +3 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -344,6 +344,7 @@ class GuiSD:
|
|
344 |
vae_model=None,
|
345 |
type_model_precision=torch.float16,
|
346 |
retain_task_model_in_cache=False,
|
|
|
347 |
)
|
348 |
|
349 |
def infer_short(self, model, pipe_params, progress=gr.Progress(track_tqdm=True)):
|
@@ -371,6 +372,8 @@ class GuiSD:
|
|
371 |
if incompatible_vae:
|
372 |
vae_model = None
|
373 |
|
|
|
|
|
374 |
self.model.load_pipe(
|
375 |
model_name,
|
376 |
task_name=task_stablepy[task],
|
@@ -551,6 +554,7 @@ class GuiSD:
|
|
551 |
|
552 |
# First load
|
553 |
model_precision = torch.float16
|
|
|
554 |
if not self.model:
|
555 |
from stablepy import Model_Diffusers
|
556 |
|
@@ -716,17 +720,17 @@ class GuiSD:
|
|
716 |
info_state = info_state + "<br>" + vae_msg
|
717 |
if msg_lora:
|
718 |
info_state = info_state + "<br>" + "<br>".join(msg_lora)
|
719 |
-
yield self.infer_short(self.model, pipe_params), info_state
|
720 |
|
721 |
sd_gen = GuiSD()
|
722 |
|
723 |
-
|
724 |
-
def sd_gen_load_new_model(*args):
|
725 |
-
yield from sd_gen.load_new_model(*args)
|
726 |
|
727 |
@spaces.GPU
|
728 |
-
def sd_gen_generate_pipeline(*args):
|
729 |
-
yield from sd_gen.generate_pipeline(*args)
|
730 |
|
731 |
## BEGIN MOD
|
732 |
CSS ="""
|
@@ -763,505 +767,508 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', elem_id="main", fill_width=True, cs
|
|
763 |
This space is a modification of [r3gm's DiffuseCraft](https://huggingface.co/spaces/r3gm/DiffuseCraft).
|
764 |
"""
|
765 |
)
|
766 |
-
with gr.
|
767 |
with gr.Tab("Generation"):
|
768 |
-
with gr.
|
769 |
-
|
770 |
-
|
771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
772 |
with gr.Group():
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
with gr.Row():
|
790 |
-
|
791 |
-
|
|
|
792 |
with gr.Row():
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
prompt_type_gui = gr.Radio(label="Convert tags to", choices=["danbooru", "e621"], value="e621", visible=False)
|
805 |
-
prompt_type_button = gr.Button(value="Convert prompt to Pony e621 style", size="sm", variant="secondary")
|
806 |
-
with gr.Row():
|
807 |
-
character_dbt = gr.Textbox(lines=1, placeholder="kafuu chino, ...", label="Character names")
|
808 |
-
series_dbt = gr.Textbox(lines=1, placeholder="Is the order a rabbit?, ...", label="Series names")
|
809 |
-
random_character_gui = gr.Button(value="Random character 🎲", size="sm", variant="secondary")
|
810 |
-
model_name_dbt = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0], visible=False)
|
811 |
-
aspect_ratio_dbt = gr.Radio(label="Aspect ratio", choices=list(V2_ASPECT_RATIO_OPTIONS), value="square", visible=False)
|
812 |
-
length_dbt = gr.Radio(label="Length", choices=list(V2_LENGTH_OPTIONS), value="very_long", visible=False)
|
813 |
-
identity_dbt = gr.Radio(label="Keep identity", choices=list(V2_IDENTITY_OPTIONS), value="lax", visible=False)
|
814 |
-
ban_tags_dbt = gr.Textbox(label="Ban tags", placeholder="alternate costumen, ...", value="futanari, censored, furry, furrification", visible=False)
|
815 |
-
copy_button_dbt = gr.Button(value="Copy to clipboard", visible=False)
|
816 |
-
rating_dbt = gr.Radio(label="Rating", choices=list(V2_RATING_OPTIONS), value="sfw")
|
817 |
-
generate_db_random_button = gr.Button(value="EXTEND PROMPT 🎲")
|
818 |
with gr.Row():
|
819 |
set_random_seed = gr.Button(value="Seed 🎲", size="sm")
|
820 |
set_params_gui = gr.Button(value="Params ↙️", size="sm")
|
821 |
clear_prompt_gui = gr.Button(value="Clear 🗑️", size="sm")
|
822 |
|
823 |
-
|
824 |
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
|
849 |
-
|
850 |
|
851 |
-
|
852 |
|
853 |
-
with gr.
|
854 |
-
with gr.
|
855 |
-
img_width_gui = gr.Slider(minimum=64, maximum=4096, step=8, value=1024, label="Img Width")
|
856 |
-
img_height_gui = gr.Slider(minimum=64, maximum=4096, step=8, value=1024, label="Img Height")
|
857 |
-
steps_gui = gr.Slider(minimum=1, maximum=100, step=1, value=28, label="Steps")
|
858 |
-
cfg_gui = gr.Slider(minimum=0, maximum=30, step=0.5, value=7.0, label="CFG")
|
859 |
-
with gr.Row():
|
860 |
-
seed_gui = gr.Number(minimum=-1, maximum=9999999999, value=-1, label="Seed")
|
861 |
-
num_images_gui = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Images")
|
862 |
-
clip_skip_gui = gr.Checkbox(value=False, label="Layer 2 Clip Skip")
|
863 |
-
free_u_gui = gr.Checkbox(value=False, label="FreeU")
|
864 |
-
with gr.Row():
|
865 |
-
sampler_gui = gr.Dropdown(label="Sampler", choices=scheduler_names, value="Euler a")
|
866 |
-
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list, value=vae_model_list[0])
|
867 |
-
prompt_s_options = [
|
868 |
-
("Compel format: (word)weight", "Compel"),
|
869 |
-
("Classic format: (word:weight)", "Classic"),
|
870 |
-
("Classic-original format: (word:weight)", "Classic-original"),
|
871 |
-
("Classic-no_norm format: (word:weight)", "Classic-no_norm"),
|
872 |
-
("Classic-ignore", "Classic-ignore"),
|
873 |
-
("None", "None"),
|
874 |
-
]
|
875 |
-
prompt_syntax_gui = gr.Dropdown(label="Prompt Syntax", choices=prompt_s_options, value=prompt_s_options[1][1])
|
876 |
-
|
877 |
-
with gr.Row(equal_height=False):
|
878 |
-
def run_set_params_gui(base_prompt):
|
879 |
-
valid_receptors = { # default values
|
880 |
-
"prompt": gr.update(value=base_prompt),
|
881 |
-
"neg_prompt": gr.update(value=""),
|
882 |
-
"Steps": gr.update(value=30),
|
883 |
-
"width": gr.update(value=1024),
|
884 |
-
"height": gr.update(value=1024),
|
885 |
-
"Seed": gr.update(value=-1),
|
886 |
-
"Sampler": gr.update(value="Euler a"),
|
887 |
-
"scale": gr.update(value=7.5), # cfg
|
888 |
-
"skip": gr.update(value=True),
|
889 |
-
}
|
890 |
-
valid_keys = list(valid_receptors.keys())
|
891 |
-
|
892 |
-
parameters = extract_parameters(base_prompt)
|
893 |
-
for key, val in parameters.items():
|
894 |
-
# print(val)
|
895 |
-
if key in valid_keys:
|
896 |
-
if key == "Sampler":
|
897 |
-
if val not in scheduler_names:
|
898 |
-
continue
|
899 |
-
elif key == "skip":
|
900 |
-
if int(val) >= 2:
|
901 |
-
val = True
|
902 |
-
if key == "prompt":
|
903 |
-
if ">" in val and "<" in val:
|
904 |
-
val = re.sub(r'<[^>]+>', '', val)
|
905 |
-
print("Removed LoRA written in the prompt")
|
906 |
-
if key in ["prompt", "neg_prompt"]:
|
907 |
-
val = val.strip()
|
908 |
-
if key in ["Steps", "width", "height", "Seed"]:
|
909 |
-
val = int(val)
|
910 |
-
if key == "scale":
|
911 |
-
val = float(val)
|
912 |
-
if key == "Seed":
|
913 |
-
continue
|
914 |
-
valid_receptors[key] = gr.update(value=val)
|
915 |
-
# print(val, type(val))
|
916 |
-
# print(valid_receptors)
|
917 |
-
return [value for value in valid_receptors.values()]
|
918 |
-
|
919 |
-
set_params_gui.click(
|
920 |
-
run_set_params_gui, [prompt_gui],[
|
921 |
-
prompt_gui,
|
922 |
-
neg_prompt_gui,
|
923 |
-
steps_gui,
|
924 |
-
img_width_gui,
|
925 |
-
img_height_gui,
|
926 |
-
seed_gui,
|
927 |
-
sampler_gui,
|
928 |
-
cfg_gui,
|
929 |
-
clip_skip_gui,
|
930 |
-
],
|
931 |
-
)
|
932 |
-
|
933 |
-
def run_clear_prompt_gui():
|
934 |
-
return gr.update(value=""), gr.update(value="")
|
935 |
-
clear_prompt_gui.click(
|
936 |
-
run_clear_prompt_gui, [], [prompt_gui, neg_prompt_gui]
|
937 |
-
)
|
938 |
-
|
939 |
-
def run_set_random_seed():
|
940 |
-
return -1
|
941 |
-
set_random_seed.click(
|
942 |
-
run_set_random_seed, [], seed_gui
|
943 |
-
)
|
944 |
-
|
945 |
-
with gr.Accordion("LoRA", open=False, visible=True) as menu_lora:
|
946 |
-
with gr.Row():
|
947 |
-
with gr.Column():
|
948 |
-
lora1_gui = gr.Dropdown(label="LoRA1", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
949 |
-
lora_scale_1_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 1")
|
950 |
-
with gr.Row():
|
951 |
-
with gr.Group():
|
952 |
-
lora1_info_gui = gr.Textbox(label="LoRA1 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
953 |
-
lora1_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
954 |
-
lora1_desc_gui = gr.Markdown(value="", visible=False)
|
955 |
-
with gr.Column():
|
956 |
-
lora2_gui = gr.Dropdown(label="LoRA2", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
957 |
-
lora_scale_2_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 2")
|
958 |
-
with gr.Row():
|
959 |
-
with gr.Group():
|
960 |
-
lora2_info_gui = gr.Textbox(label="LoRA2 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
961 |
-
lora2_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
962 |
-
lora2_desc_gui = gr.Markdown(value="", visible=False)
|
963 |
-
with gr.Column():
|
964 |
-
lora3_gui = gr.Dropdown(label="LoRA3", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
965 |
-
lora_scale_3_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 3")
|
966 |
-
with gr.Row():
|
967 |
-
with gr.Group():
|
968 |
-
lora3_info_gui = gr.Textbox(label="LoRA3 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
969 |
-
lora3_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
970 |
-
lora3_desc_gui = gr.Markdown(value="", visible=False)
|
971 |
-
with gr.Column():
|
972 |
-
lora4_gui = gr.Dropdown(label="LoRA4", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
973 |
-
lora_scale_4_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 4")
|
974 |
-
with gr.Row():
|
975 |
-
with gr.Group():
|
976 |
-
lora4_info_gui = gr.Textbox(label="LoRA4 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
977 |
-
lora4_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
978 |
-
lora4_desc_gui = gr.Markdown(value="", visible=False)
|
979 |
-
with gr.Column():
|
980 |
-
lora5_gui = gr.Dropdown(label="LoRA5", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
981 |
-
lora_scale_5_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 5")
|
982 |
-
with gr.Row():
|
983 |
-
with gr.Group():
|
984 |
-
lora5_info_gui = gr.Textbox(label="LoRA5 prompts", info="Example of prompt", value="None", show_copy_button=True, interactive=False, visible=False)
|
985 |
-
lora5_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
986 |
-
lora5_desc_gui = gr.Markdown(value="", visible=False)
|
987 |
-
with gr.Accordion("From URL", open=True, visible=True):
|
988 |
-
with gr.Row():
|
989 |
-
search_civitai_query_lora = gr.Textbox(label="Query", placeholder="oomuro sakurako...", lines=1)
|
990 |
-
search_civitai_basemodel_lora = gr.CheckboxGroup(label="Search LoRA for", choices=["Pony", "SD 1.5", "SDXL 1.0"], value=["Pony", "SDXL 1.0"])
|
991 |
-
search_civitai_button_lora = gr.Button("Search on Civitai")
|
992 |
-
search_civitai_desc_lora = gr.Markdown(value="", visible=False)
|
993 |
-
search_civitai_result_lora = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
|
994 |
-
text_lora = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
995 |
-
button_lora = gr.Button("Get and update lists of LoRAs")
|
996 |
-
with gr.Accordion("From Local", open=True, visible=True):
|
997 |
-
file_output_lora = gr.File(label="Uploaded LoRA", file_types=['.ckpt', '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple", interactive=False, visible=False)
|
998 |
-
upload_button_lora = gr.UploadButton(label="Upload LoRA from your disk (very slow)", file_types=['.ckpt' , '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple")
|
999 |
-
|
1000 |
-
with gr.Column() as menu_advanced:
|
1001 |
-
with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
|
1002 |
-
upscaler_keys = list(upscaler_dict_gui.keys())
|
1003 |
-
upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=upscaler_dict_gui[upscaler_keys[0]])
|
1004 |
with gr.Row():
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
|
|
1008 |
with gr.Row():
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
|
1014 |
-
|
1015 |
-
with gr.Accordion("Detailfix", open=False, visible=True) as menu_detail:
|
1016 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1017 |
|
1018 |
-
|
1019 |
-
|
|
|
|
|
|
|
1020 |
|
1021 |
-
|
1022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1023 |
|
1024 |
-
|
1025 |
-
|
1026 |
-
adetailer_sampler_gui = gr.Dropdown(label="Adetailer sampler:", choices=adetailer_sampler_options, value="Use same sampler")
|
1027 |
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
with gr.Row():
|
1034 |
-
|
1035 |
-
|
1036 |
-
person_detector_ad_a_gui = gr.Checkbox(label="Person detector", value=True)
|
1037 |
-
hand_detector_ad_a_gui = gr.Checkbox(label="Hand detector", value=False)
|
1038 |
with gr.Row():
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1048 |
with gr.Row():
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
with gr.Row():
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1074 |
)
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
def change_preprocessor_choices(task):
|
1079 |
-
task = task_stablepy[task]
|
1080 |
-
if task in preprocessor_controlnet.keys():
|
1081 |
-
choices_task = preprocessor_controlnet[task]
|
1082 |
-
else:
|
1083 |
-
choices_task = preprocessor_controlnet["canny"]
|
1084 |
-
return gr.update(choices=choices_task, value=choices_task[0])
|
1085 |
-
|
1086 |
-
task_gui.change(
|
1087 |
-
change_preprocessor_choices,
|
1088 |
-
[task_gui],
|
1089 |
-
[preprocessor_name_gui],
|
1090 |
-
)
|
1091 |
-
with gr.Row():
|
1092 |
-
preprocess_resolution_gui = gr.Slider(minimum=64, maximum=2048, step=64, value=512, label="Preprocess Resolution")
|
1093 |
-
low_threshold_gui = gr.Slider(minimum=1, maximum=255, step=1, value=100, label="Canny low threshold")
|
1094 |
-
high_threshold_gui = gr.Slider(minimum=1, maximum=255, step=1, value=200, label="Canny high threshold")
|
1095 |
-
value_threshold_gui = gr.Slider(minimum=1, maximum=2.0, step=0.01, value=0.1, label="Hough value threshold (MLSD)")
|
1096 |
-
with gr.Row():
|
1097 |
-
distance_threshold_gui = gr.Slider(minimum=1, maximum=20.0, step=0.01, value=0.1, label="Hough distance threshold (MLSD)")
|
1098 |
-
control_net_output_scaling_gui = gr.Slider(minimum=0, maximum=5.0, step=0.1, value=1, label="ControlNet Output Scaling in UNet")
|
1099 |
-
control_net_start_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=0, label="ControlNet Start Threshold (%)")
|
1100 |
-
control_net_stop_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=1, label="ControlNet Stop Threshold (%)")
|
1101 |
|
1102 |
-
|
|
|
|
|
|
|
1103 |
|
1104 |
-
|
1105 |
-
|
|
|
1106 |
|
1107 |
-
|
1108 |
-
with gr.Row():
|
1109 |
-
image_ip1 = gr.Image(label="IP Image", type="filepath")
|
1110 |
-
mask_ip1 = gr.Image(label="IP Mask", type="filepath")
|
1111 |
-
with gr.Row():
|
1112 |
-
model_ip1 = gr.Dropdown(value="plus_face", label="Model", choices=IP_MODELS)
|
1113 |
-
mode_ip1 = gr.Dropdown(value="original", label="Mode", choices=MODE_IP_OPTIONS)
|
1114 |
-
scale_ip1 = gr.Slider(minimum=0., maximum=2., step=0.01, value=0.7, label="Scale")
|
1115 |
-
with gr.Accordion("IP-Adapter 2", open=True, visible=True):
|
1116 |
-
with gr.Row():
|
1117 |
-
image_ip2 = gr.Image(label="IP Image", type="filepath")
|
1118 |
-
mask_ip2 = gr.Image(label="IP Mask (optional)", type="filepath")
|
1119 |
-
with gr.Row():
|
1120 |
-
model_ip2 = gr.Dropdown(value="base", label="Model", choices=IP_MODELS)
|
1121 |
-
mode_ip2 = gr.Dropdown(value="style", label="Mode", choices=MODE_IP_OPTIONS)
|
1122 |
-
scale_ip2 = gr.Slider(minimum=0., maximum=2., step=0.01, value=0.7, label="Scale")
|
1123 |
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
value=
|
1141 |
-
label="
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
with gr.Row():
|
1160 |
-
image_previews_gui = gr.Checkbox(value=False, label="Image Previews")
|
1161 |
-
hires_before_adetailer_gui = gr.Checkbox(value=False, label="Hires Before Adetailer")
|
1162 |
-
hires_after_adetailer_gui = gr.Checkbox(value=True, label="Hires After Adetailer")
|
1163 |
-
generator_in_cpu_gui = gr.Checkbox(value=False, label="Generator in CPU")
|
1164 |
-
|
1165 |
-
with gr.Accordion("More settings", open=False, visible=False):
|
1166 |
-
loop_generation_gui = gr.Slider(minimum=1, value=1, label="Loop Generation")
|
1167 |
-
retain_task_cache_gui = gr.Checkbox(value=True, label="Retain task model in cache")
|
1168 |
-
leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
|
1169 |
-
disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
|
1170 |
-
display_images_gui = gr.Checkbox(value=False, label="Display Images")
|
1171 |
-
save_generated_images_gui = gr.Checkbox(value=False, label="Save Generated Images")
|
1172 |
-
image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
|
1173 |
-
retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
|
1174 |
-
retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
|
1175 |
-
retain_hires_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Hires Model Previous Load")
|
1176 |
-
xformers_memory_efficient_attention_gui = gr.Checkbox(value=False, label="Xformers Memory Efficient Attention")
|
1177 |
-
|
1178 |
-
with gr.Accordion("Examples and help", open=False, visible=True) as menu_example:
|
1179 |
-
gr.Examples(
|
1180 |
-
examples=[
|
1181 |
-
[
|
1182 |
-
"1girl, souryuu asuka langley, neon genesis evangelion, plugsuit, pilot suit, red bodysuit, sitting, crossing legs, black eye patch, cat hat, throne, symmetrical, looking down, from bottom, looking at viewer, outdoors, masterpiece, best quality, very aesthetic, absurdres",
|
1183 |
-
"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1184 |
-
1,
|
1185 |
-
30,
|
1186 |
-
7.5,
|
1187 |
-
True,
|
1188 |
-
-1,
|
1189 |
-
"Euler a",
|
1190 |
-
1152,
|
1191 |
-
896,
|
1192 |
-
"votepurchase/animagine-xl-3.1",
|
1193 |
-
],
|
1194 |
-
[
|
1195 |
-
"solo, princess Zelda OOT, score_9, score_8_up, score_8, medium breasts, cute, eyelashes, cute small face, long hair, crown braid, hairclip, pointy ears, soft curvy body, looking at viewer, smile, blush, white dress, medium body, (((holding the Master Sword))), standing, deep forest in the background",
|
1196 |
-
"score_6, score_5, score_4, busty, ugly face, mutated hands, low res, blurry face, black and white,",
|
1197 |
-
1,
|
1198 |
-
30,
|
1199 |
-
5.,
|
1200 |
-
True,
|
1201 |
-
-1,
|
1202 |
-
"Euler a",
|
1203 |
-
1024,
|
1204 |
-
1024,
|
1205 |
-
"votepurchase/ponyDiffusionV6XL",
|
1206 |
-
],
|
1207 |
-
[
|
1208 |
-
"1girl, oomuro sakurako, yuru yuri, official art, school uniform, anime artwork, anime style, vibrant, studio anime, highly detailed, masterpiece, best quality, very aesthetic, absurdres",
|
1209 |
-
"photo, deformed, black and white, realism, disfigured, low contrast, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1210 |
-
1,
|
1211 |
-
40,
|
1212 |
-
7.0,
|
1213 |
-
True,
|
1214 |
-
-1,
|
1215 |
-
"Euler a",
|
1216 |
-
1024,
|
1217 |
-
1024,
|
1218 |
-
"Raelina/Rae-Diffusion-XL-V2",
|
1219 |
-
],
|
1220 |
-
[
|
1221 |
-
"1girl, akaza akari, yuru yuri, official art, anime artwork, anime style, vibrant, studio anime, highly detailed, masterpiece, best quality, very aesthetic, absurdres",
|
1222 |
-
"photo, deformed, black and white, realism, disfigured, low contrast, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1223 |
-
1,
|
1224 |
-
35,
|
1225 |
-
7.0,
|
1226 |
-
True,
|
1227 |
-
-1,
|
1228 |
-
"Euler a",
|
1229 |
-
1024,
|
1230 |
-
1024,
|
1231 |
-
"Raelina/Raemu-XL-V4",
|
1232 |
-
],
|
1233 |
-
[
|
1234 |
-
"yoshida yuuko, machikado mazoku, 1girl, solo, demon horns,horns, school uniform, long hair, open mouth, skirt, demon girl, ahoge, shiny, shiny hair, anime artwork",
|
1235 |
-
"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1236 |
-
1,
|
1237 |
-
50,
|
1238 |
-
7.,
|
1239 |
-
True,
|
1240 |
-
-1,
|
1241 |
-
"Euler a",
|
1242 |
-
1024,
|
1243 |
-
1024,
|
1244 |
-
"votepurchase/animagine-xl-3.1",
|
1245 |
-
],
|
1246 |
],
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
model_name_gui,
|
1260 |
],
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
## END MOD
|
1266 |
|
1267 |
with gr.Tab("Inpaint mask maker", render=True):
|
|
|
344 |
vae_model=None,
|
345 |
type_model_precision=torch.float16,
|
346 |
retain_task_model_in_cache=False,
|
347 |
+
device="cpu",
|
348 |
)
|
349 |
|
350 |
def infer_short(self, model, pipe_params, progress=gr.Progress(track_tqdm=True)):
|
|
|
372 |
if incompatible_vae:
|
373 |
vae_model = None
|
374 |
|
375 |
+
self.model.device = torch.device("cpu")
|
376 |
+
|
377 |
self.model.load_pipe(
|
378 |
model_name,
|
379 |
task_name=task_stablepy[task],
|
|
|
554 |
|
555 |
# First load
|
556 |
model_precision = torch.float16
|
557 |
+
self.model.device = torch.device("cuda:0")
|
558 |
if not self.model:
|
559 |
from stablepy import Model_Diffusers
|
560 |
|
|
|
720 |
info_state = info_state + "<br>" + vae_msg
|
721 |
if msg_lora:
|
722 |
info_state = info_state + "<br>" + "<br>".join(msg_lora)
|
723 |
+
yield self.infer_short(self.model, pipe_params, progress), info_state
|
724 |
|
725 |
sd_gen = GuiSD()
|
726 |
|
727 |
+
#@spaces.GPU
|
728 |
+
def sd_gen_load_new_model(*args, progress=gr.Progress(track_tqdm=True)):
|
729 |
+
yield from sd_gen.load_new_model(*args, progress)
|
730 |
|
731 |
@spaces.GPU
|
732 |
+
def sd_gen_generate_pipeline(*args, progress=gr.Progress(track_tqdm=True)):
|
733 |
+
yield from sd_gen.generate_pipeline(*args, progress)
|
734 |
|
735 |
## BEGIN MOD
|
736 |
CSS ="""
|
|
|
767 |
This space is a modification of [r3gm's DiffuseCraft](https://huggingface.co/spaces/r3gm/DiffuseCraft).
|
768 |
"""
|
769 |
)
|
770 |
+
with gr.Column():
|
771 |
with gr.Tab("Generation"):
|
772 |
+
with gr.Row():
|
773 |
+
with gr.Column(scale=2):
|
774 |
+
interface_mode_gui = gr.Radio(label="Quick settings", choices=["Simple", "Standard", "Fast", "LoRA"], value="Standard")
|
775 |
+
with gr.Accordion("Model and Task", open=False) as menu_model:
|
776 |
+
task_gui = gr.Dropdown(label="Task", choices=sdxl_task, value=task_model_list[0])
|
777 |
+
with gr.Group():
|
778 |
+
model_name_gui = gr.Dropdown(label="Model", info="You can enter a huggingface model repo_id to want to use.", choices=get_tupled_model_list(model_list), value="votepurchase/animagine-xl-3.1", allow_custom_value=True)
|
779 |
+
model_info_gui = gr.Markdown(elem_id="model-info")
|
780 |
+
with gr.Row():
|
781 |
+
quick_model_type_gui = gr.Radio(label="Model Type", choices=["None", "Auto", "Animagine", "Pony"], value="Auto", interactive=True)
|
782 |
+
quick_genre_gui = gr.Radio(label="Genre", choices=["Anime", "Photo"], value="Anime", interactive=True)
|
783 |
+
quick_speed_gui = gr.Radio(label="Speed", choices=["Fast", "Standard", "Heavy"], value="Standard", interactive=True)
|
784 |
+
quick_aspect_gui = gr.Radio(label="Aspect Ratio", choices=["1:1", "3:4"], value="1:1", interactive=True)
|
785 |
+
with gr.Row():
|
786 |
+
quality_selector_gui = gr.Dropdown(label="Quality Tags Presets", interactive=True, choices=list(preset_quality.keys()), value="None")
|
787 |
+
style_selector_gui = gr.Dropdown(label="Style Preset", interactive=True, choices=list(preset_styles.keys()), value="None")
|
788 |
+
sampler_selector_gui = gr.Dropdown(label="Sampler Quick Settings", interactive=True, choices=list(preset_sampler_setting.keys()), value="None")
|
789 |
+
optimization_gui = gr.Dropdown(label="Optimization for SDXL", choices=list(optimization_list.keys()), value="None", interactive=True)
|
790 |
with gr.Group():
|
791 |
+
with gr.Accordion("Prompt from Image", open=False) as menu_from_image:
|
792 |
+
input_image_gui = gr.Image(label="Input image", type="pil", sources=["upload", "clipboard"], height=256)
|
793 |
+
with gr.Accordion(label="Advanced options", open=False):
|
794 |
+
with gr.Row():
|
795 |
+
general_threshold_gui = gr.Slider(label="Threshold", minimum=0.0, maximum=1.0, value=0.3, step=0.01, interactive=True)
|
796 |
+
character_threshold_gui = gr.Slider(label="Character threshold", minimum=0.0, maximum=1.0, value=0.8, step=0.01, interactive=True)
|
797 |
+
with gr.Row():
|
798 |
+
tag_type_gui = gr.Radio(label="Convert tags to", info="danbooru for Animagine, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru")
|
799 |
+
recom_prompt_gui = gr.Radio(label="Insert reccomended prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True)
|
800 |
+
keep_tags_gui = gr.Radio(label="Remove tags leaving only the following", choices=["body", "dress", "all"], value="all")
|
801 |
+
image_algorithms = gr.CheckboxGroup(["Use WD Tagger"], label="Algorithms", value=["Use WD Tagger"], visible=False)
|
802 |
+
generate_from_image_btn_gui = gr.Button(value="GENERATE TAGS FROM IMAGE")
|
803 |
+
prompt_gui = gr.Textbox(lines=6, placeholder="1girl, solo, ...", label="Prompt", show_copy_button=True)
|
804 |
+
with gr.Accordion("Negative prompt, etc.", open=False) as menu_negative:
|
805 |
+
neg_prompt_gui = gr.Textbox(lines=3, placeholder="lowres, (bad), ...", label="Negative prompt", show_copy_button=True)
|
806 |
+
translate_prompt_button = gr.Button(value="Translate prompt to English", size="sm", variant="secondary")
|
807 |
with gr.Row():
|
808 |
+
insert_prompt_gui = gr.Radio(label="Insert reccomended positive / negative prompt", choices=["None", "Auto", "Animagine", "Pony"], value="Auto", interactive=True)
|
809 |
+
prompt_type_gui = gr.Radio(label="Convert tags to", choices=["danbooru", "e621"], value="e621", visible=False)
|
810 |
+
prompt_type_button = gr.Button(value="Convert prompt to Pony e621 style", size="sm", variant="secondary")
|
811 |
with gr.Row():
|
812 |
+
character_dbt = gr.Textbox(lines=1, placeholder="kafuu chino, ...", label="Character names")
|
813 |
+
series_dbt = gr.Textbox(lines=1, placeholder="Is the order a rabbit?, ...", label="Series names")
|
814 |
+
random_character_gui = gr.Button(value="Random character 🎲", size="sm", variant="secondary")
|
815 |
+
model_name_dbt = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0], visible=False)
|
816 |
+
aspect_ratio_dbt = gr.Radio(label="Aspect ratio", choices=list(V2_ASPECT_RATIO_OPTIONS), value="square", visible=False)
|
817 |
+
length_dbt = gr.Radio(label="Length", choices=list(V2_LENGTH_OPTIONS), value="very_long", visible=False)
|
818 |
+
identity_dbt = gr.Radio(label="Keep identity", choices=list(V2_IDENTITY_OPTIONS), value="lax", visible=False)
|
819 |
+
ban_tags_dbt = gr.Textbox(label="Ban tags", placeholder="alternate costumen, ...", value="futanari, censored, furry, furrification", visible=False)
|
820 |
+
copy_button_dbt = gr.Button(value="Copy to clipboard", visible=False)
|
821 |
+
rating_dbt = gr.Radio(label="Rating", choices=list(V2_RATING_OPTIONS), value="sfw")
|
822 |
+
generate_db_random_button = gr.Button(value="EXTEND PROMPT 🎲")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
823 |
with gr.Row():
|
824 |
set_random_seed = gr.Button(value="Seed 🎲", size="sm")
|
825 |
set_params_gui = gr.Button(value="Params ↙️", size="sm")
|
826 |
clear_prompt_gui = gr.Button(value="Clear 🗑️", size="sm")
|
827 |
|
828 |
+
generate_button = gr.Button(value="GENERATE IMAGE", size="lg", variant="primary")
|
829 |
|
830 |
+
model_name_gui.change(
|
831 |
+
update_task_options,
|
832 |
+
[model_name_gui, task_gui],
|
833 |
+
[task_gui],
|
834 |
+
)
|
835 |
|
836 |
+
load_model_gui = gr.HTML()
|
837 |
+
|
838 |
+
result_images = gr.Gallery(
|
839 |
+
label="Generated images",
|
840 |
+
show_label=False,
|
841 |
+
elem_id="gallery",
|
842 |
+
columns=[2],
|
843 |
+
rows=[2],
|
844 |
+
object_fit="contain",
|
845 |
+
# height="auto",
|
846 |
+
interactive=False,
|
847 |
+
preview=False,
|
848 |
+
show_share_button=False,
|
849 |
+
show_download_button=True,
|
850 |
+
selected_index=50,
|
851 |
+
format="png",
|
852 |
+
)
|
853 |
|
854 |
+
result_images_files = gr.Files(interactive=False, visible=False)
|
855 |
|
856 |
+
actual_task_info = gr.HTML()
|
857 |
|
858 |
+
with gr.Column(scale=1):
|
859 |
+
with gr.Accordion("Generation settings", open=False, visible=True) as menu_gen:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
860 |
with gr.Row():
|
861 |
+
img_width_gui = gr.Slider(minimum=64, maximum=4096, step=8, value=1024, label="Img Width")
|
862 |
+
img_height_gui = gr.Slider(minimum=64, maximum=4096, step=8, value=1024, label="Img Height")
|
863 |
+
steps_gui = gr.Slider(minimum=1, maximum=100, step=1, value=28, label="Steps")
|
864 |
+
cfg_gui = gr.Slider(minimum=0, maximum=30, step=0.5, value=7.0, label="CFG")
|
865 |
with gr.Row():
|
866 |
+
seed_gui = gr.Number(minimum=-1, maximum=9999999999, value=-1, label="Seed")
|
867 |
+
num_images_gui = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Images")
|
868 |
+
clip_skip_gui = gr.Checkbox(value=False, label="Layer 2 Clip Skip")
|
869 |
+
free_u_gui = gr.Checkbox(value=False, label="FreeU")
|
|
|
|
|
|
|
870 |
with gr.Row():
|
871 |
+
sampler_gui = gr.Dropdown(label="Sampler", choices=scheduler_names, value="Euler a")
|
872 |
+
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list, value=vae_model_list[0])
|
873 |
+
prompt_s_options = [
|
874 |
+
("Compel format: (word)weight", "Compel"),
|
875 |
+
("Classic format: (word:weight)", "Classic"),
|
876 |
+
("Classic-original format: (word:weight)", "Classic-original"),
|
877 |
+
("Classic-no_norm format: (word:weight)", "Classic-no_norm"),
|
878 |
+
("Classic-ignore", "Classic-ignore"),
|
879 |
+
("None", "None"),
|
880 |
+
]
|
881 |
+
prompt_syntax_gui = gr.Dropdown(label="Prompt Syntax", choices=prompt_s_options, value=prompt_s_options[1][1])
|
882 |
+
|
883 |
+
with gr.Row(equal_height=False):
|
884 |
+
def run_set_params_gui(base_prompt):
|
885 |
+
valid_receptors = { # default values
|
886 |
+
"prompt": gr.update(value=base_prompt),
|
887 |
+
"neg_prompt": gr.update(value=""),
|
888 |
+
"Steps": gr.update(value=30),
|
889 |
+
"width": gr.update(value=1024),
|
890 |
+
"height": gr.update(value=1024),
|
891 |
+
"Seed": gr.update(value=-1),
|
892 |
+
"Sampler": gr.update(value="Euler a"),
|
893 |
+
"scale": gr.update(value=7.5), # cfg
|
894 |
+
"skip": gr.update(value=True),
|
895 |
+
}
|
896 |
+
valid_keys = list(valid_receptors.keys())
|
897 |
+
|
898 |
+
parameters = extract_parameters(base_prompt)
|
899 |
+
for key, val in parameters.items():
|
900 |
+
# print(val)
|
901 |
+
if key in valid_keys:
|
902 |
+
if key == "Sampler":
|
903 |
+
if val not in scheduler_names:
|
904 |
+
continue
|
905 |
+
elif key == "skip":
|
906 |
+
if int(val) >= 2:
|
907 |
+
val = True
|
908 |
+
if key == "prompt":
|
909 |
+
if ">" in val and "<" in val:
|
910 |
+
val = re.sub(r'<[^>]+>', '', val)
|
911 |
+
print("Removed LoRA written in the prompt")
|
912 |
+
if key in ["prompt", "neg_prompt"]:
|
913 |
+
val = val.strip()
|
914 |
+
if key in ["Steps", "width", "height", "Seed"]:
|
915 |
+
val = int(val)
|
916 |
+
if key == "scale":
|
917 |
+
val = float(val)
|
918 |
+
if key == "Seed":
|
919 |
+
continue
|
920 |
+
valid_receptors[key] = gr.update(value=val)
|
921 |
+
# print(val, type(val))
|
922 |
+
# print(valid_receptors)
|
923 |
+
return [value for value in valid_receptors.values()]
|
924 |
+
|
925 |
+
set_params_gui.click(
|
926 |
+
run_set_params_gui, [prompt_gui],[
|
927 |
+
prompt_gui,
|
928 |
+
neg_prompt_gui,
|
929 |
+
steps_gui,
|
930 |
+
img_width_gui,
|
931 |
+
img_height_gui,
|
932 |
+
seed_gui,
|
933 |
+
sampler_gui,
|
934 |
+
cfg_gui,
|
935 |
+
clip_skip_gui,
|
936 |
+
],
|
937 |
+
)
|
938 |
+
|
939 |
+
def run_clear_prompt_gui():
|
940 |
+
return gr.update(value=""), gr.update(value="")
|
941 |
+
clear_prompt_gui.click(
|
942 |
+
run_clear_prompt_gui, [], [prompt_gui, neg_prompt_gui]
|
943 |
+
)
|
944 |
|
945 |
+
def run_set_random_seed():
|
946 |
+
return -1
|
947 |
+
set_random_seed.click(
|
948 |
+
run_set_random_seed, [], seed_gui
|
949 |
+
)
|
950 |
|
951 |
+
with gr.Accordion("LoRA", open=False, visible=True) as menu_lora:
|
952 |
+
with gr.Row():
|
953 |
+
with gr.Column():
|
954 |
+
lora1_gui = gr.Dropdown(label="LoRA1", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
955 |
+
lora_scale_1_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 1")
|
956 |
+
with gr.Row():
|
957 |
+
with gr.Group():
|
958 |
+
lora1_info_gui = gr.Textbox(label="LoRA1 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
959 |
+
lora1_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
960 |
+
lora1_desc_gui = gr.Markdown(value="", visible=False)
|
961 |
+
with gr.Column():
|
962 |
+
lora2_gui = gr.Dropdown(label="LoRA2", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
963 |
+
lora_scale_2_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 2")
|
964 |
+
with gr.Row():
|
965 |
+
with gr.Group():
|
966 |
+
lora2_info_gui = gr.Textbox(label="LoRA2 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
967 |
+
lora2_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
968 |
+
lora2_desc_gui = gr.Markdown(value="", visible=False)
|
969 |
+
with gr.Column():
|
970 |
+
lora3_gui = gr.Dropdown(label="LoRA3", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
971 |
+
lora_scale_3_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 3")
|
972 |
+
with gr.Row():
|
973 |
+
with gr.Group():
|
974 |
+
lora3_info_gui = gr.Textbox(label="LoRA3 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
975 |
+
lora3_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
976 |
+
lora3_desc_gui = gr.Markdown(value="", visible=False)
|
977 |
+
with gr.Column():
|
978 |
+
lora4_gui = gr.Dropdown(label="LoRA4", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
979 |
+
lora_scale_4_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 4")
|
980 |
+
with gr.Row():
|
981 |
+
with gr.Group():
|
982 |
+
lora4_info_gui = gr.Textbox(label="LoRA4 prompts", info="Example of prompt:", value="None", show_copy_button=True, interactive=False, visible=False)
|
983 |
+
lora4_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
984 |
+
lora4_desc_gui = gr.Markdown(value="", visible=False)
|
985 |
+
with gr.Column():
|
986 |
+
lora5_gui = gr.Dropdown(label="LoRA5", choices=get_all_lora_tupled_list(), value="", allow_custom_value=True, elem_classes="lora", min_width=320)
|
987 |
+
lora_scale_5_gui = gr.Slider(minimum=-2, maximum=2, step=0.01, value=1.00, label="LoRA Scale 5")
|
988 |
+
with gr.Row():
|
989 |
+
with gr.Group():
|
990 |
+
lora5_info_gui = gr.Textbox(label="LoRA5 prompts", info="Example of prompt", value="None", show_copy_button=True, interactive=False, visible=False)
|
991 |
+
lora5_copy_gui = gr.Button(value="Copy example to prompt", visible=False)
|
992 |
+
lora5_desc_gui = gr.Markdown(value="", visible=False)
|
993 |
+
with gr.Accordion("From URL", open=True, visible=True):
|
994 |
+
with gr.Row():
|
995 |
+
search_civitai_query_lora = gr.Textbox(label="Query", placeholder="oomuro sakurako...", lines=1)
|
996 |
+
search_civitai_basemodel_lora = gr.CheckboxGroup(label="Search LoRA for", choices=["Pony", "SD 1.5", "SDXL 1.0"], value=["Pony", "SDXL 1.0"])
|
997 |
+
search_civitai_button_lora = gr.Button("Search on Civitai")
|
998 |
+
search_civitai_desc_lora = gr.Markdown(value="", visible=False)
|
999 |
+
search_civitai_result_lora = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
|
1000 |
+
text_lora = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
1001 |
+
button_lora = gr.Button("Get and update lists of LoRAs")
|
1002 |
+
with gr.Accordion("From Local", open=True, visible=True):
|
1003 |
+
file_output_lora = gr.File(label="Uploaded LoRA", file_types=['.ckpt', '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple", interactive=False, visible=False)
|
1004 |
+
upload_button_lora = gr.UploadButton(label="Upload LoRA from your disk (very slow)", file_types=['.ckpt' , '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple")
|
1005 |
+
|
1006 |
+
with gr.Column() as menu_advanced:
|
1007 |
+
with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
|
1008 |
+
upscaler_keys = list(upscaler_dict_gui.keys())
|
1009 |
+
upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=upscaler_dict_gui[upscaler_keys[0]])
|
1010 |
+
with gr.Row():
|
1011 |
+
upscaler_increases_size_gui = gr.Slider(minimum=1.1, maximum=6., step=0.1, value=1.0, label="Upscale by")
|
1012 |
+
esrgan_tile_gui = gr.Slider(minimum=0, value=100, maximum=500, step=1, label="ESRGAN Tile")
|
1013 |
+
esrgan_tile_overlap_gui = gr.Slider(minimum=1, maximum=200, step=1, value=10, label="ESRGAN Tile Overlap")
|
1014 |
+
with gr.Row():
|
1015 |
+
hires_steps_gui = gr.Slider(minimum=0, value=30, maximum=100, step=1, label="Hires Steps")
|
1016 |
+
hires_denoising_strength_gui = gr.Slider(minimum=0.1, maximum=1.0, step=0.01, value=0.55, label="Hires Denoising Strength")
|
1017 |
+
hires_sampler_gui = gr.Dropdown(label="Hires Sampler", choices=["Use same sampler"] + scheduler_names[:-1], value="Use same sampler")
|
1018 |
+
hires_prompt_gui = gr.Textbox(label="Hires Prompt", placeholder="Main prompt will be use", lines=3)
|
1019 |
+
hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
|
1020 |
|
1021 |
+
with gr.Accordion("Detailfix", open=False, visible=True) as menu_detail:
|
1022 |
+
with gr.Row():
|
|
|
1023 |
|
1024 |
+
# Adetailer Inpaint Only
|
1025 |
+
adetailer_inpaint_only_gui = gr.Checkbox(label="Inpaint only", value=True)
|
1026 |
+
|
1027 |
+
# Adetailer Verbose
|
1028 |
+
adetailer_verbose_gui = gr.Checkbox(label="Verbose", value=False)
|
1029 |
+
|
1030 |
+
# Adetailer Sampler
|
1031 |
+
adetailer_sampler_options = ["Use same sampler"] + scheduler_names[:-1]
|
1032 |
+
adetailer_sampler_gui = gr.Dropdown(label="Adetailer sampler:", choices=adetailer_sampler_options, value="Use same sampler")
|
1033 |
+
|
1034 |
+
with gr.Accordion("Detailfix A", open=True, visible=True):
|
1035 |
+
# Adetailer A
|
1036 |
+
adetailer_active_a_gui = gr.Checkbox(label="Enable Adetailer A", value=False)
|
1037 |
+
prompt_ad_a_gui = gr.Textbox(label="Main prompt", placeholder="Main prompt will be use", lines=3)
|
1038 |
+
negative_prompt_ad_a_gui = gr.Textbox(label="Negative prompt", placeholder="Main negative prompt will be use", lines=3)
|
1039 |
+
with gr.Row():
|
1040 |
+
strength_ad_a_gui = gr.Number(label="Strength:", value=0.35, step=0.01, minimum=0.01, maximum=1.0)
|
1041 |
+
face_detector_ad_a_gui = gr.Checkbox(label="Face detector", value=True)
|
1042 |
+
person_detector_ad_a_gui = gr.Checkbox(label="Person detector", value=True)
|
1043 |
+
hand_detector_ad_a_gui = gr.Checkbox(label="Hand detector", value=False)
|
1044 |
+
with gr.Row():
|
1045 |
+
mask_dilation_a_gui = gr.Number(label="Mask dilation:", value=4, minimum=1)
|
1046 |
+
mask_blur_a_gui = gr.Number(label="Mask blur:", value=4, minimum=1)
|
1047 |
+
mask_padding_a_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
|
1048 |
+
|
1049 |
+
with gr.Accordion("Detailfix B", open=True, visible=True):
|
1050 |
+
# Adetailer B
|
1051 |
+
adetailer_active_b_gui = gr.Checkbox(label="Enable Adetailer B", value=False)
|
1052 |
+
prompt_ad_b_gui = gr.Textbox(label="Main prompt", placeholder="Main prompt will be use", lines=3)
|
1053 |
+
negative_prompt_ad_b_gui = gr.Textbox(label="Negative prompt", placeholder="Main negative prompt will be use", lines=3)
|
1054 |
+
with gr.Row():
|
1055 |
+
strength_ad_b_gui = gr.Number(label="Strength:", value=0.35, step=0.01, minimum=0.01, maximum=1.0)
|
1056 |
+
face_detector_ad_b_gui = gr.Checkbox(label="Face detector", value=True)
|
1057 |
+
person_detector_ad_b_gui = gr.Checkbox(label="Person detector", value=True)
|
1058 |
+
hand_detector_ad_b_gui = gr.Checkbox(label="Hand detector", value=False)
|
1059 |
+
with gr.Row():
|
1060 |
+
mask_dilation_b_gui = gr.Number(label="Mask dilation:", value=4, minimum=1)
|
1061 |
+
mask_blur_b_gui = gr.Number(label="Mask blur:", value=4, minimum=1)
|
1062 |
+
mask_padding_b_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
|
1063 |
+
|
1064 |
+
with gr.Accordion("Textual inversion", open=False, visible=True) as menu_ti:
|
1065 |
+
active_textual_inversion_gui = gr.Checkbox(value=False, label="Active Textual Inversion in prompt")
|
1066 |
+
use_textual_inversion_gui = gr.CheckboxGroup(choices=get_embed_list(get_model_pipeline(model_name_gui.value)) if active_textual_inversion_gui.value else [], value=None, label="Use Textual Invertion in prompt")
|
1067 |
+
def update_textual_inversion_gui(active_textual_inversion_gui, model_name_gui):
|
1068 |
+
return gr.update(choices=get_embed_list(get_model_pipeline(model_name_gui)) if active_textual_inversion_gui else [])
|
1069 |
+
active_textual_inversion_gui.change(update_textual_inversion_gui, [active_textual_inversion_gui, model_name_gui], [use_textual_inversion_gui])
|
1070 |
+
model_name_gui.change(update_textual_inversion_gui, [active_textual_inversion_gui, model_name_gui], [use_textual_inversion_gui])
|
1071 |
+
|
1072 |
+
with gr.Accordion("ControlNet / Img2img / Inpaint", open=False, visible=True) as menu_i2i:
|
1073 |
with gr.Row():
|
1074 |
+
image_control = gr.Image(label="Image ControlNet/Inpaint/Img2img", type="filepath")
|
1075 |
+
image_mask_gui = gr.Image(label="Image Mask", type="filepath")
|
|
|
|
|
1076 |
with gr.Row():
|
1077 |
+
strength_gui = gr.Slider(
|
1078 |
+
minimum=0.01, maximum=1.0, step=0.01, value=0.55, label="Strength",
|
1079 |
+
info="This option adjusts the level of changes for img2img and inpainting."
|
1080 |
+
)
|
1081 |
+
image_resolution_gui = gr.Slider(minimum=64, maximum=2048, step=64, value=1024, label="Image Resolution")
|
1082 |
+
preprocessor_name_gui = gr.Dropdown(label="Preprocessor Name", choices=preprocessor_controlnet["canny"], value=preprocessor_controlnet["canny"][0])
|
1083 |
+
|
1084 |
+
def change_preprocessor_choices(task):
|
1085 |
+
task = task_stablepy[task]
|
1086 |
+
if task in preprocessor_controlnet.keys():
|
1087 |
+
choices_task = preprocessor_controlnet[task]
|
1088 |
+
else:
|
1089 |
+
choices_task = preprocessor_controlnet["canny"]
|
1090 |
+
return gr.update(choices=choices_task, value=choices_task[0])
|
1091 |
+
|
1092 |
+
task_gui.change(
|
1093 |
+
change_preprocessor_choices,
|
1094 |
+
[task_gui],
|
1095 |
+
[preprocessor_name_gui],
|
1096 |
+
)
|
1097 |
with gr.Row():
|
1098 |
+
preprocess_resolution_gui = gr.Slider(minimum=64, maximum=2048, step=64, value=512, label="Preprocess Resolution")
|
1099 |
+
low_threshold_gui = gr.Slider(minimum=1, maximum=255, step=1, value=100, label="Canny low threshold")
|
1100 |
+
high_threshold_gui = gr.Slider(minimum=1, maximum=255, step=1, value=200, label="Canny high threshold")
|
1101 |
+
value_threshold_gui = gr.Slider(minimum=1, maximum=2.0, step=0.01, value=0.1, label="Hough value threshold (MLSD)")
|
1102 |
with gr.Row():
|
1103 |
+
distance_threshold_gui = gr.Slider(minimum=1, maximum=20.0, step=0.01, value=0.1, label="Hough distance threshold (MLSD)")
|
1104 |
+
control_net_output_scaling_gui = gr.Slider(minimum=0, maximum=5.0, step=0.1, value=1, label="ControlNet Output Scaling in UNet")
|
1105 |
+
control_net_start_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=0, label="ControlNet Start Threshold (%)")
|
1106 |
+
control_net_stop_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=1, label="ControlNet Stop Threshold (%)")
|
1107 |
+
|
1108 |
+
with gr.Accordion("IP-Adapter", open=False, visible=True) as menu_ipa:##############
|
1109 |
+
|
1110 |
+
IP_MODELS = sorted(list(set(IP_ADAPTERS_SD + IP_ADAPTERS_SDXL)))
|
1111 |
+
MODE_IP_OPTIONS = ["original", "style", "layout", "style+layout"]
|
1112 |
+
|
1113 |
+
with gr.Accordion("IP-Adapter 1", open=True, visible=True):
|
1114 |
+
with gr.Row():
|
1115 |
+
image_ip1 = gr.Image(label="IP Image", type="filepath")
|
1116 |
+
mask_ip1 = gr.Image(label="IP Mask", type="filepath")
|
1117 |
+
with gr.Row():
|
1118 |
+
model_ip1 = gr.Dropdown(value="plus_face", label="Model", choices=IP_MODELS)
|
1119 |
+
mode_ip1 = gr.Dropdown(value="original", label="Mode", choices=MODE_IP_OPTIONS)
|
1120 |
+
scale_ip1 = gr.Slider(minimum=0., maximum=2., step=0.01, value=0.7, label="Scale")
|
1121 |
+
with gr.Accordion("IP-Adapter 2", open=True, visible=True):
|
1122 |
+
with gr.Row():
|
1123 |
+
image_ip2 = gr.Image(label="IP Image", type="filepath")
|
1124 |
+
mask_ip2 = gr.Image(label="IP Mask (optional)", type="filepath")
|
1125 |
+
with gr.Row():
|
1126 |
+
model_ip2 = gr.Dropdown(value="base", label="Model", choices=IP_MODELS)
|
1127 |
+
mode_ip2 = gr.Dropdown(value="style", label="Mode", choices=MODE_IP_OPTIONS)
|
1128 |
+
scale_ip2 = gr.Slider(minimum=0., maximum=2., step=0.01, value=0.7, label="Scale")
|
1129 |
+
|
1130 |
+
with gr.Accordion("T2I adapter", open=False, visible=True) as menu_t2i:
|
1131 |
+
t2i_adapter_preprocessor_gui = gr.Checkbox(value=True, label="T2i Adapter Preprocessor")
|
1132 |
+
with gr.Row():
|
1133 |
+
adapter_conditioning_scale_gui = gr.Slider(minimum=0, maximum=5., step=0.1, value=1, label="Adapter Conditioning Scale")
|
1134 |
+
adapter_conditioning_factor_gui = gr.Slider(minimum=0, maximum=1., step=0.01, value=0.55, label="Adapter Conditioning Factor (%)")
|
1135 |
+
|
1136 |
+
with gr.Accordion("Styles", open=False, visible=True) as menu_styles:
|
1137 |
+
|
1138 |
+
try:
|
1139 |
+
style_names_found = sd_gen.model.STYLE_NAMES
|
1140 |
+
except:
|
1141 |
+
style_names_found = STYLE_NAMES
|
1142 |
+
|
1143 |
+
style_prompt_gui = gr.Dropdown(
|
1144 |
+
style_names_found,
|
1145 |
+
multiselect=True,
|
1146 |
+
value=None,
|
1147 |
+
label="Style Prompt",
|
1148 |
+
interactive=True,
|
1149 |
)
|
1150 |
+
style_json_gui = gr.File(label="Style JSON File")
|
1151 |
+
style_button = gr.Button("Load styles")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1152 |
|
1153 |
+
def load_json_style_file(json):
|
1154 |
+
if not sd_gen.model:
|
1155 |
+
gr.Info("First load the model")
|
1156 |
+
return gr.update(value=None, choices=STYLE_NAMES)
|
1157 |
|
1158 |
+
sd_gen.model.load_style_file(json)
|
1159 |
+
gr.Info(f"{len(sd_gen.model.STYLE_NAMES)} styles loaded")
|
1160 |
+
return gr.update(value=None, choices=sd_gen.model.STYLE_NAMES)
|
1161 |
|
1162 |
+
style_button.click(load_json_style_file, [style_json_gui], [style_prompt_gui])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1163 |
|
1164 |
+
with gr.Accordion("Other settings", open=False, visible=True) as menu_other:
|
1165 |
+
with gr.Row():
|
1166 |
+
image_previews_gui = gr.Checkbox(value=False, label="Image Previews")
|
1167 |
+
hires_before_adetailer_gui = gr.Checkbox(value=False, label="Hires Before Adetailer")
|
1168 |
+
hires_after_adetailer_gui = gr.Checkbox(value=True, label="Hires After Adetailer")
|
1169 |
+
generator_in_cpu_gui = gr.Checkbox(value=False, label="Generator in CPU")
|
1170 |
+
|
1171 |
+
with gr.Accordion("More settings", open=False, visible=False):
|
1172 |
+
loop_generation_gui = gr.Slider(minimum=1, value=1, label="Loop Generation")
|
1173 |
+
retain_task_cache_gui = gr.Checkbox(value=True, label="Retain task model in cache")
|
1174 |
+
leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
|
1175 |
+
disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
|
1176 |
+
display_images_gui = gr.Checkbox(value=False, label="Display Images")
|
1177 |
+
save_generated_images_gui = gr.Checkbox(value=False, label="Save Generated Images")
|
1178 |
+
image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
|
1179 |
+
retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
|
1180 |
+
retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
|
1181 |
+
retain_hires_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Hires Model Previous Load")
|
1182 |
+
xformers_memory_efficient_attention_gui = gr.Checkbox(value=False, label="Xformers Memory Efficient Attention")
|
1183 |
+
|
1184 |
+
with gr.Accordion("Examples and help", open=True, visible=True) as menu_example:
|
1185 |
+
gr.Examples(
|
1186 |
+
examples=[
|
1187 |
+
[
|
1188 |
+
"1girl, souryuu asuka langley, neon genesis evangelion, plugsuit, pilot suit, red bodysuit, sitting, crossing legs, black eye patch, cat hat, throne, symmetrical, looking down, from bottom, looking at viewer, outdoors, masterpiece, best quality, very aesthetic, absurdres",
|
1189 |
+
"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1190 |
+
1,
|
1191 |
+
30,
|
1192 |
+
7.5,
|
1193 |
+
True,
|
1194 |
+
-1,
|
1195 |
+
"Euler a",
|
1196 |
+
1152,
|
1197 |
+
896,
|
1198 |
+
"votepurchase/animagine-xl-3.1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1199 |
],
|
1200 |
+
[
|
1201 |
+
"solo, princess Zelda OOT, score_9, score_8_up, score_8, medium breasts, cute, eyelashes, cute small face, long hair, crown braid, hairclip, pointy ears, soft curvy body, looking at viewer, smile, blush, white dress, medium body, (((holding the Master Sword))), standing, deep forest in the background",
|
1202 |
+
"score_6, score_5, score_4, busty, ugly face, mutated hands, low res, blurry face, black and white,",
|
1203 |
+
1,
|
1204 |
+
30,
|
1205 |
+
5.,
|
1206 |
+
True,
|
1207 |
+
-1,
|
1208 |
+
"Euler a",
|
1209 |
+
1024,
|
1210 |
+
1024,
|
1211 |
+
"votepurchase/ponyDiffusionV6XL",
|
|
|
1212 |
],
|
1213 |
+
[
|
1214 |
+
"1girl, oomuro sakurako, yuru yuri, official art, school uniform, anime artwork, anime style, vibrant, studio anime, highly detailed, masterpiece, best quality, very aesthetic, absurdres",
|
1215 |
+
"photo, deformed, black and white, realism, disfigured, low contrast, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1216 |
+
1,
|
1217 |
+
40,
|
1218 |
+
7.0,
|
1219 |
+
True,
|
1220 |
+
-1,
|
1221 |
+
"Euler a",
|
1222 |
+
1024,
|
1223 |
+
1024,
|
1224 |
+
"Raelina/Rae-Diffusion-XL-V2",
|
1225 |
+
],
|
1226 |
+
[
|
1227 |
+
"1girl, akaza akari, yuru yuri, official art, anime artwork, anime style, vibrant, studio anime, highly detailed, masterpiece, best quality, very aesthetic, absurdres",
|
1228 |
+
"photo, deformed, black and white, realism, disfigured, low contrast, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1229 |
+
1,
|
1230 |
+
35,
|
1231 |
+
7.0,
|
1232 |
+
True,
|
1233 |
+
-1,
|
1234 |
+
"Euler a",
|
1235 |
+
1024,
|
1236 |
+
1024,
|
1237 |
+
"Raelina/Raemu-XL-V4",
|
1238 |
+
],
|
1239 |
+
[
|
1240 |
+
"yoshida yuuko, machikado mazoku, 1girl, solo, demon horns,horns, school uniform, long hair, open mouth, skirt, demon girl, ahoge, shiny, shiny hair, anime artwork",
|
1241 |
+
"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
|
1242 |
+
1,
|
1243 |
+
50,
|
1244 |
+
7.,
|
1245 |
+
True,
|
1246 |
+
-1,
|
1247 |
+
"Euler a",
|
1248 |
+
1024,
|
1249 |
+
1024,
|
1250 |
+
"votepurchase/animagine-xl-3.1",
|
1251 |
+
],
|
1252 |
+
],
|
1253 |
+
#fn=sd_gen.generate_pipeline,
|
1254 |
+
fn=sd_gen_generate_pipeline,
|
1255 |
+
inputs=[
|
1256 |
+
prompt_gui,
|
1257 |
+
neg_prompt_gui,
|
1258 |
+
num_images_gui,
|
1259 |
+
steps_gui,
|
1260 |
+
cfg_gui,
|
1261 |
+
clip_skip_gui,
|
1262 |
+
seed_gui,
|
1263 |
+
sampler_gui,
|
1264 |
+
img_height_gui,
|
1265 |
+
img_width_gui,
|
1266 |
+
model_name_gui,
|
1267 |
+
],
|
1268 |
+
outputs=[result_images],
|
1269 |
+
cache_examples=False,
|
1270 |
+
elem_id="examples",
|
1271 |
+
)
|
1272 |
## END MOD
|
1273 |
|
1274 |
with gr.Tab("Inpaint mask maker", render=True):
|
modutils.py
CHANGED
@@ -858,7 +858,7 @@ def find_similar_lora(q: str):
|
|
858 |
def change_interface_mode(mode: str):
|
859 |
if mode == "Fast":
|
860 |
return gr.update(open=False), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
861 |
-
gr.update(visible=True), gr.update(open=False), gr.update(visible=True), gr.update(open=
|
862 |
gr.update(visible=True), gr.update(value="Fast")
|
863 |
elif mode == "Simple": # t2i mode
|
864 |
return gr.update(open=True), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
@@ -866,11 +866,11 @@ def change_interface_mode(mode: str):
|
|
866 |
gr.update(visible=False), gr.update(value="Standard")
|
867 |
elif mode == "LoRA": # t2i LoRA mode
|
868 |
return gr.update(open=True), gr.update(visible=True), gr.update(open=True), gr.update(open=False),\
|
869 |
-
gr.update(visible=True), gr.update(open=True), gr.update(visible=True), gr.update(open=
|
870 |
gr.update(visible=False), gr.update(value="Standard")
|
871 |
else: # Standard
|
872 |
return gr.update(open=False), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
873 |
-
gr.update(visible=True), gr.update(open=False), gr.update(visible=True), gr.update(open=
|
874 |
gr.update(visible=True), gr.update(value="Standard")
|
875 |
|
876 |
|
|
|
858 |
def change_interface_mode(mode: str):
|
859 |
if mode == "Fast":
|
860 |
return gr.update(open=False), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
861 |
+
gr.update(visible=True), gr.update(open=False), gr.update(visible=True), gr.update(open=True),\
|
862 |
gr.update(visible=True), gr.update(value="Fast")
|
863 |
elif mode == "Simple": # t2i mode
|
864 |
return gr.update(open=True), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
|
|
866 |
gr.update(visible=False), gr.update(value="Standard")
|
867 |
elif mode == "LoRA": # t2i LoRA mode
|
868 |
return gr.update(open=True), gr.update(visible=True), gr.update(open=True), gr.update(open=False),\
|
869 |
+
gr.update(visible=True), gr.update(open=True), gr.update(visible=True), gr.update(open=True),\
|
870 |
gr.update(visible=False), gr.update(value="Standard")
|
871 |
else: # Standard
|
872 |
return gr.update(open=False), gr.update(visible=True), gr.update(open=False), gr.update(open=False),\
|
873 |
+
gr.update(visible=True), gr.update(open=False), gr.update(visible=True), gr.update(open=True),\
|
874 |
gr.update(visible=True), gr.update(value="Standard")
|
875 |
|
876 |
|
requirements.txt
CHANGED
@@ -12,4 +12,5 @@ httpx==0.13.3
|
|
12 |
httpcore
|
13 |
googletrans==4.0.0rc1
|
14 |
timm
|
15 |
-
rapidfuzz
|
|
|
|
12 |
httpcore
|
13 |
googletrans==4.0.0rc1
|
14 |
timm
|
15 |
+
rapidfuzz
|
16 |
+
sentencepiece
|