Spaces:
Sleeping
Sleeping
add config.py
Browse files
app.py
CHANGED
@@ -26,7 +26,8 @@ import urllib.parse
|
|
26 |
from config import (
|
27 |
MINIMUM_IMAGE_NUMBER,
|
28 |
MAXIMUM_IMAGE_NUMBER,
|
29 |
-
DEFAULT_NEGATIVE_PROMPT
|
|
|
30 |
)
|
31 |
|
32 |
preprocessor_controlnet = {
|
@@ -829,7 +830,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
829 |
task_gui = gr.Dropdown(
|
830 |
label="Task",
|
831 |
choices=sdxl_task,
|
832 |
-
value=task_model_list[0]
|
833 |
)
|
834 |
model_name_gui = gr.Dropdown(
|
835 |
label="Model",
|
@@ -839,8 +840,9 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
839 |
)
|
840 |
prompt_gui = gr.Textbox(
|
841 |
lines=5,
|
842 |
-
placeholder="Enter prompt",
|
843 |
-
label="Prompt"
|
|
|
844 |
)
|
845 |
neg_prompt_gui = gr.Textbox(
|
846 |
lines=3,
|
@@ -895,10 +897,31 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
895 |
value=7.5,
|
896 |
label="CFG"
|
897 |
)
|
898 |
-
sampler_gui = gr.Dropdown(
|
899 |
-
|
900 |
-
|
901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
902 |
with gr.Row():
|
903 |
clip_skip_gui = gr.Checkbox(value=True, label="Layer 2 Clip Skip")
|
904 |
free_u_gui = gr.Checkbox(value=True, label="FreeU")
|
@@ -1022,7 +1045,13 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1022 |
value=1.4,
|
1023 |
label="Upscale by"
|
1024 |
)
|
1025 |
-
esrgan_tile_gui = gr.Slider(
|
|
|
|
|
|
|
|
|
|
|
|
|
1026 |
esrgan_tile_overlap_gui = gr.Slider(
|
1027 |
minimum=1,
|
1028 |
maximum=200,
|
@@ -1072,17 +1101,57 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1072 |
value=0.33,
|
1073 |
label="Lora Scale 1"
|
1074 |
)
|
1075 |
-
lora2_gui = gr.Dropdown(
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1083 |
|
1084 |
with gr.Accordion("From URL", open=False, visible=True):
|
1085 |
-
text_lora = gr.Textbox(
|
|
|
|
|
|
|
|
|
1086 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
1087 |
button_lora.click(
|
1088 |
get_my_lora,
|
@@ -1148,27 +1217,74 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1148 |
value=512,
|
1149 |
label="Preprocess Resolution"
|
1150 |
)
|
1151 |
-
low_threshold_gui = gr.Slider(
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1165 |
|
1166 |
with gr.Accordion("T2I adapter", open=False, visible=True):
|
1167 |
-
t2i_adapter_preprocessor_gui = gr.Checkbox(
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1172 |
|
1173 |
with gr.Accordion("Styles", open=False, visible=True):
|
1174 |
|
@@ -1198,10 +1314,17 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1198 |
return gr.update(value=None, choices=sd_gen.model.STYLE_NAMES)
|
1199 |
|
1200 |
|
1201 |
-
style_button.click(
|
|
|
|
|
|
|
|
|
1202 |
|
1203 |
with gr.Accordion("Textual inversion", open=False, visible=False):
|
1204 |
-
active_textual_inversion_gui = gr.Checkbox(
|
|
|
|
|
|
|
1205 |
|
1206 |
with gr.Accordion("Detailfix", open=False, visible=True):
|
1207 |
|
@@ -1213,8 +1336,11 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1213 |
|
1214 |
# Adetailer Sampler
|
1215 |
adetailer_sampler_options = ["Use same sampler"] + scheduler_names[:-1]
|
1216 |
-
adetailer_sampler_gui = gr.Dropdown(
|
1217 |
-
|
|
|
|
|
|
|
1218 |
|
1219 |
with gr.Accordion("Detailfix A", open=False, visible=True):
|
1220 |
# Adetailer A
|
@@ -1344,7 +1470,8 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1344 |
5. Convert an image to a coloring drawing
|
1345 |
6. ControlNet OpenPose SD 1.5
|
1346 |
|
1347 |
-
- Different tasks can be performed, such as img2img or using the IP adapter,
|
|
|
1348 |
"""
|
1349 |
)
|
1350 |
gr.Examples(
|
@@ -1782,14 +1909,22 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
|
|
1782 |
img_result = gr.Image(label="Mask image", show_label=True, interactive=False)
|
1783 |
btn_send = gr.Button("Send to the first tab")
|
1784 |
|
1785 |
-
btn.click(
|
|
|
|
|
|
|
|
|
1786 |
|
1787 |
|
1788 |
def send_img(img_source, img_result):
|
1789 |
return img_source, img_result
|
1790 |
|
1791 |
|
1792 |
-
btn_send.click(
|
|
|
|
|
|
|
|
|
1793 |
|
1794 |
generate_button.click(
|
1795 |
fn=sd_gen.load_new_model,
|
|
|
26 |
from config import (
|
27 |
MINIMUM_IMAGE_NUMBER,
|
28 |
MAXIMUM_IMAGE_NUMBER,
|
29 |
+
DEFAULT_NEGATIVE_PROMPT,
|
30 |
+
DEFAULT_POSITIVE_PROMPT
|
31 |
)
|
32 |
|
33 |
preprocessor_controlnet = {
|
|
|
830 |
task_gui = gr.Dropdown(
|
831 |
label="Task",
|
832 |
choices=sdxl_task,
|
833 |
+
value=task_model_list[-6] or task_model_list[0],
|
834 |
)
|
835 |
model_name_gui = gr.Dropdown(
|
836 |
label="Model",
|
|
|
840 |
)
|
841 |
prompt_gui = gr.Textbox(
|
842 |
lines=5,
|
843 |
+
placeholder="Enter Positive prompt",
|
844 |
+
label="Prompt",
|
845 |
+
value=DEFAULT_POSITIVE_PROMPT
|
846 |
)
|
847 |
neg_prompt_gui = gr.Textbox(
|
848 |
lines=3,
|
|
|
897 |
value=7.5,
|
898 |
label="CFG"
|
899 |
)
|
900 |
+
sampler_gui = gr.Dropdown(
|
901 |
+
label="Sampler",
|
902 |
+
choices=scheduler_names,
|
903 |
+
value="DPM++ 2M Karras"
|
904 |
+
)
|
905 |
+
img_width_gui = gr.Slider(
|
906 |
+
minimum=64,
|
907 |
+
maximum=4096,
|
908 |
+
step=8,
|
909 |
+
value=1024,
|
910 |
+
label="Img Width"
|
911 |
+
)
|
912 |
+
img_height_gui = gr.Slider(
|
913 |
+
minimum=64,
|
914 |
+
maximum=4096,
|
915 |
+
step=8,
|
916 |
+
value=1024,
|
917 |
+
label="Img Height"
|
918 |
+
)
|
919 |
+
seed_gui = gr.Number(
|
920 |
+
minimum=-1,
|
921 |
+
maximum=9999999999,
|
922 |
+
value=-1,
|
923 |
+
label="Seed"
|
924 |
+
)
|
925 |
with gr.Row():
|
926 |
clip_skip_gui = gr.Checkbox(value=True, label="Layer 2 Clip Skip")
|
927 |
free_u_gui = gr.Checkbox(value=True, label="FreeU")
|
|
|
1045 |
value=1.4,
|
1046 |
label="Upscale by"
|
1047 |
)
|
1048 |
+
esrgan_tile_gui = gr.Slider(
|
1049 |
+
minimum=0,
|
1050 |
+
value=100,
|
1051 |
+
maximum=500,
|
1052 |
+
step=1,
|
1053 |
+
label="ESRGAN Tile"
|
1054 |
+
)
|
1055 |
esrgan_tile_overlap_gui = gr.Slider(
|
1056 |
minimum=1,
|
1057 |
maximum=200,
|
|
|
1101 |
value=0.33,
|
1102 |
label="Lora Scale 1"
|
1103 |
)
|
1104 |
+
lora2_gui = gr.Dropdown(
|
1105 |
+
label="Lora2",
|
1106 |
+
choices=lora_model_list
|
1107 |
+
)
|
1108 |
+
lora_scale_2_gui = gr.Slider(
|
1109 |
+
minimum=-2,
|
1110 |
+
maximum=2,
|
1111 |
+
step=0.01,
|
1112 |
+
value=0.33,
|
1113 |
+
label="Lora Scale 2"
|
1114 |
+
)
|
1115 |
+
lora3_gui = gr.Dropdown(
|
1116 |
+
label="Lora3",
|
1117 |
+
choices=lora_model_list
|
1118 |
+
)
|
1119 |
+
lora_scale_3_gui = gr.Slider(
|
1120 |
+
minimum=-2,
|
1121 |
+
maximum=2,
|
1122 |
+
step=0.01,
|
1123 |
+
value=0.33,
|
1124 |
+
label="Lora Scale 3"
|
1125 |
+
)
|
1126 |
+
lora4_gui = gr.Dropdown(
|
1127 |
+
label="Lora4",
|
1128 |
+
choices=lora_model_list
|
1129 |
+
)
|
1130 |
+
lora_scale_4_gui = gr.Slider(
|
1131 |
+
minimum=-2,
|
1132 |
+
maximum=2,
|
1133 |
+
step=0.01,
|
1134 |
+
value=0.33,
|
1135 |
+
label="Lora Scale 4"
|
1136 |
+
)
|
1137 |
+
lora5_gui = gr.Dropdown(
|
1138 |
+
label="Lora5",
|
1139 |
+
choices=lora_model_list
|
1140 |
+
)
|
1141 |
+
lora_scale_5_gui = gr.Slider(
|
1142 |
+
minimum=-2,
|
1143 |
+
maximum=2,
|
1144 |
+
step=0.01,
|
1145 |
+
value=0.33,
|
1146 |
+
label="Lora Scale 5"
|
1147 |
+
)
|
1148 |
|
1149 |
with gr.Accordion("From URL", open=False, visible=True):
|
1150 |
+
text_lora = gr.Textbox(
|
1151 |
+
label="URL",
|
1152 |
+
placeholder="http://...my_lora_url.safetensors",
|
1153 |
+
lines=1
|
1154 |
+
)
|
1155 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
1156 |
button_lora.click(
|
1157 |
get_my_lora,
|
|
|
1217 |
value=512,
|
1218 |
label="Preprocess Resolution"
|
1219 |
)
|
1220 |
+
low_threshold_gui = gr.Slider(
|
1221 |
+
minimum=1,
|
1222 |
+
maximum=255,
|
1223 |
+
step=1,
|
1224 |
+
value=100,
|
1225 |
+
label="Canny low threshold"
|
1226 |
+
)
|
1227 |
+
high_threshold_gui = gr.Slider(
|
1228 |
+
minimum=1,
|
1229 |
+
maximum=255,
|
1230 |
+
step=1,
|
1231 |
+
value=200,
|
1232 |
+
label="Canny high threshold"
|
1233 |
+
)
|
1234 |
+
value_threshold_gui = gr.Slider(
|
1235 |
+
minimum=1,
|
1236 |
+
maximum=2.0,
|
1237 |
+
step=0.01, value=0.1,
|
1238 |
+
label="Hough value threshold (MLSD)"
|
1239 |
+
)
|
1240 |
+
distance_threshold_gui = gr.Slider(
|
1241 |
+
minimum=1,
|
1242 |
+
maximum=20.0,
|
1243 |
+
step=0.01,
|
1244 |
+
value=0.1,
|
1245 |
+
label="Hough distance threshold (MLSD)"
|
1246 |
+
)
|
1247 |
+
control_net_output_scaling_gui = gr.Slider(
|
1248 |
+
minimum=0,
|
1249 |
+
maximum=5.0,
|
1250 |
+
step=0.1,
|
1251 |
+
value=1,
|
1252 |
+
label="ControlNet Output Scaling in UNet"
|
1253 |
+
)
|
1254 |
+
control_net_start_threshold_gui = gr.Slider(
|
1255 |
+
minimum=0,
|
1256 |
+
maximum=1,
|
1257 |
+
step=0.01,
|
1258 |
+
value=0,
|
1259 |
+
label="ControlNet Start Threshold (%)"
|
1260 |
+
)
|
1261 |
+
control_net_stop_threshold_gui = gr.Slider(
|
1262 |
+
minimum=0,
|
1263 |
+
maximum=1,
|
1264 |
+
step=0.01,
|
1265 |
+
value=1,
|
1266 |
+
label="ControlNet Stop Threshold (%)"
|
1267 |
+
)
|
1268 |
|
1269 |
with gr.Accordion("T2I adapter", open=False, visible=True):
|
1270 |
+
t2i_adapter_preprocessor_gui = gr.Checkbox(
|
1271 |
+
value=True,
|
1272 |
+
label="T2i Adapter Preprocessor"
|
1273 |
+
)
|
1274 |
+
adapter_conditioning_scale_gui = gr.Slider(
|
1275 |
+
minimum=0,
|
1276 |
+
maximum=5.,
|
1277 |
+
step=0.1,
|
1278 |
+
value=1,
|
1279 |
+
label="Adapter Conditioning Scale"
|
1280 |
+
)
|
1281 |
+
adapter_conditioning_factor_gui = gr.Slider(
|
1282 |
+
minimum=0,
|
1283 |
+
maximum=1.,
|
1284 |
+
step=0.01,
|
1285 |
+
value=0.55,
|
1286 |
+
label="Adapter Conditioning Factor (%)"
|
1287 |
+
)
|
1288 |
|
1289 |
with gr.Accordion("Styles", open=False, visible=True):
|
1290 |
|
|
|
1314 |
return gr.update(value=None, choices=sd_gen.model.STYLE_NAMES)
|
1315 |
|
1316 |
|
1317 |
+
style_button.click(
|
1318 |
+
load_json_style_file,
|
1319 |
+
[style_json_gui],
|
1320 |
+
[style_prompt_gui]
|
1321 |
+
)
|
1322 |
|
1323 |
with gr.Accordion("Textual inversion", open=False, visible=False):
|
1324 |
+
active_textual_inversion_gui = gr.Checkbox(
|
1325 |
+
value=False,
|
1326 |
+
label="Active Textual Inversion in prompt"
|
1327 |
+
)
|
1328 |
|
1329 |
with gr.Accordion("Detailfix", open=False, visible=True):
|
1330 |
|
|
|
1336 |
|
1337 |
# Adetailer Sampler
|
1338 |
adetailer_sampler_options = ["Use same sampler"] + scheduler_names[:-1]
|
1339 |
+
adetailer_sampler_gui = gr.Dropdown(
|
1340 |
+
label="Adetailer sampler:",
|
1341 |
+
choices=adetailer_sampler_options,
|
1342 |
+
value="Use same sampler"
|
1343 |
+
)
|
1344 |
|
1345 |
with gr.Accordion("Detailfix A", open=False, visible=True):
|
1346 |
# Adetailer A
|
|
|
1470 |
5. Convert an image to a coloring drawing
|
1471 |
6. ControlNet OpenPose SD 1.5
|
1472 |
|
1473 |
+
- Different tasks can be performed, such as img2img or using the IP adapter, \
|
1474 |
+
to preserve a person's appearance or a specific style based on an image.
|
1475 |
"""
|
1476 |
)
|
1477 |
gr.Examples(
|
|
|
1909 |
img_result = gr.Image(label="Mask image", show_label=True, interactive=False)
|
1910 |
btn_send = gr.Button("Send to the first tab")
|
1911 |
|
1912 |
+
btn.click(
|
1913 |
+
create_mask_now,
|
1914 |
+
[image_base, invert_mask],
|
1915 |
+
[img_source, img_result]
|
1916 |
+
)
|
1917 |
|
1918 |
|
1919 |
def send_img(img_source, img_result):
|
1920 |
return img_source, img_result
|
1921 |
|
1922 |
|
1923 |
+
btn_send.click(
|
1924 |
+
send_img,
|
1925 |
+
[img_source, img_result],
|
1926 |
+
[image_control, image_mask_gui]
|
1927 |
+
)
|
1928 |
|
1929 |
generate_button.click(
|
1930 |
fn=sd_gen.load_new_model,
|
config.py
CHANGED
@@ -1,32 +1,30 @@
|
|
1 |
MINIMUM_IMAGE_NUMBER = 1
|
2 |
MAXIMUM_IMAGE_NUMBER = 6
|
3 |
-
DEFAULT_NEGATIVE_PROMPT = """
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
noise, dark skin, (3d), By bad artist -neg,bhands-neg, canvas frame, (badly drawn), (badly painted),
|
8 |
"""
|
9 |
|
10 |
-
DEFAULT_POSITIVE_PROMPT = """
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
armpits, (naval),
|
32 |
"""
|
|
|
1 |
MINIMUM_IMAGE_NUMBER = 1
|
2 |
MAXIMUM_IMAGE_NUMBER = 6
|
3 |
+
DEFAULT_NEGATIVE_PROMPT = """(EasyNegative:1.05), easynegative, bad_prompt_version2, (poorly rendered), ugly, disfigured,
|
4 |
+
cross eyed, cloned face, bad symmetry, bad anatomy, low quality, blurry, text, watermark, logo,
|
5 |
+
signature, jpeg, artifacts, monochrome, paintings, oil, (hands:1.15), European Woman, woman,
|
6 |
+
noise, dark skin, (3d), By bad artist -neg,bhands-neg, canvas frame, (badly drawn), (badly painted),
|
|
|
7 |
"""
|
8 |
|
9 |
+
DEFAULT_POSITIVE_PROMPT = """1girl, loli, serious, cocky, sporty, basketball jersey, lakers, basketball, half body,
|
10 |
+
(basketball court), sweaty, dribble, high detailed, sunny, day light,
|
11 |
+
|
12 |
+
score_9, score_8_up, score_7_up, very aesthetic,
|
13 |
+
layered, white hair, featuring soft waves and a slight outward curl at the ends,
|
14 |
+
parted in the middle, (short hair),
|
15 |
+
red glowing eyes, beautiful hazel red eyes, highly detailed eyes, thin eyebrows,
|
16 |
+
detailed black eyebrows,
|
17 |
+
long eyelashes,
|
18 |
+
detailed kornea,
|
19 |
+
fisheye,
|
20 |
+
blush,
|
21 |
+
parted lips, gorgeous lips, pink thin lips,
|
22 |
+
detailed ear, human ears, human ear, highly detailed ears, highly detailed ear, detailed ears,
|
23 |
+
perfect anatomy,
|
24 |
+
|
25 |
+
five fingers,
|
26 |
+
two hands,
|
27 |
+
short girl, narrow body, detailed face, petite,
|
28 |
+
medium boobs,
|
29 |
+
armpits, (naval),
|
|
|
30 |
"""
|