Upload 8 files
Browse files- tagger/tagger.py +9 -16
tagger/tagger.py
CHANGED
|
@@ -285,9 +285,6 @@ def convert_tags_to_ja(input_prompt: str = ""):
|
|
| 285 |
return ", ".join(out_tags)
|
| 286 |
|
| 287 |
|
| 288 |
-
enable_auto_recom_prompt = True
|
| 289 |
-
|
| 290 |
-
|
| 291 |
animagine_ps = to_list("masterpiece, best quality, very aesthetic, absurdres")
|
| 292 |
animagine_nps = to_list("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]")
|
| 293 |
pony_ps = to_list("score_9, score_8_up, score_7_up, masterpiece, best quality, very aesthetic, absurdres")
|
|
@@ -297,7 +294,6 @@ other_nps = to_list("photo, deformed, black and white, realism, disfigured, low
|
|
| 297 |
default_ps = to_list("highly detailed, masterpiece, best quality, very aesthetic, absurdres")
|
| 298 |
default_nps = to_list("score_6, score_5, score_4, 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]")
|
| 299 |
def insert_recom_prompt(prompt: str = "", neg_prompt: str = "", type: str = "None"):
|
| 300 |
-
global enable_auto_recom_prompt
|
| 301 |
prompts = to_list(prompt)
|
| 302 |
neg_prompts = to_list(neg_prompt)
|
| 303 |
|
|
@@ -307,16 +303,12 @@ def insert_recom_prompt(prompt: str = "", neg_prompt: str = "", type: str = "Non
|
|
| 307 |
last_empty_p = [""] if not prompts and type != "None" else []
|
| 308 |
last_empty_np = [""] if not neg_prompts and type != "None" else []
|
| 309 |
|
| 310 |
-
if type == "
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
neg_prompts = neg_prompts + animagine_nps
|
| 317 |
-
elif type == "Pony":
|
| 318 |
-
prompts = prompts + pony_ps
|
| 319 |
-
neg_prompts = neg_prompts + pony_nps
|
| 320 |
|
| 321 |
prompt = ", ".join(list_uniq(prompts) + last_empty_p)
|
| 322 |
neg_prompt = ", ".join(list_uniq(neg_prompts) + last_empty_np)
|
|
@@ -329,7 +321,7 @@ def load_model_prompt_dict():
|
|
| 329 |
dict = {}
|
| 330 |
path = 'model_dict.json' if Path('model_dict.json').exists() else './tagger/model_dict.json'
|
| 331 |
try:
|
| 332 |
-
with open(
|
| 333 |
dict = json.load(f)
|
| 334 |
except Exception:
|
| 335 |
pass
|
|
@@ -339,7 +331,8 @@ def load_model_prompt_dict():
|
|
| 339 |
model_prompt_dict = load_model_prompt_dict()
|
| 340 |
|
| 341 |
|
| 342 |
-
def insert_model_recom_prompt(prompt: str = "", neg_prompt: str = "", model_name: str = "None"):
|
|
|
|
| 343 |
if not model_name or not enable_auto_recom_prompt: return prompt, neg_prompt
|
| 344 |
prompts = to_list(prompt)
|
| 345 |
neg_prompts = to_list(neg_prompt)
|
|
|
|
| 285 |
return ", ".join(out_tags)
|
| 286 |
|
| 287 |
|
|
|
|
|
|
|
|
|
|
| 288 |
animagine_ps = to_list("masterpiece, best quality, very aesthetic, absurdres")
|
| 289 |
animagine_nps = to_list("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]")
|
| 290 |
pony_ps = to_list("score_9, score_8_up, score_7_up, masterpiece, best quality, very aesthetic, absurdres")
|
|
|
|
| 294 |
default_ps = to_list("highly detailed, masterpiece, best quality, very aesthetic, absurdres")
|
| 295 |
default_nps = to_list("score_6, score_5, score_4, 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]")
|
| 296 |
def insert_recom_prompt(prompt: str = "", neg_prompt: str = "", type: str = "None"):
|
|
|
|
| 297 |
prompts = to_list(prompt)
|
| 298 |
neg_prompts = to_list(neg_prompt)
|
| 299 |
|
|
|
|
| 303 |
last_empty_p = [""] if not prompts and type != "None" else []
|
| 304 |
last_empty_np = [""] if not neg_prompts and type != "None" else []
|
| 305 |
|
| 306 |
+
if type == "Animagine":
|
| 307 |
+
prompts = prompts + animagine_ps
|
| 308 |
+
neg_prompts = neg_prompts + animagine_nps
|
| 309 |
+
elif type == "Pony":
|
| 310 |
+
prompts = prompts + pony_ps
|
| 311 |
+
neg_prompts = neg_prompts + pony_nps
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
|
| 313 |
prompt = ", ".join(list_uniq(prompts) + last_empty_p)
|
| 314 |
neg_prompt = ", ".join(list_uniq(neg_prompts) + last_empty_np)
|
|
|
|
| 321 |
dict = {}
|
| 322 |
path = 'model_dict.json' if Path('model_dict.json').exists() else './tagger/model_dict.json'
|
| 323 |
try:
|
| 324 |
+
with open(path, encoding='utf-8') as f:
|
| 325 |
dict = json.load(f)
|
| 326 |
except Exception:
|
| 327 |
pass
|
|
|
|
| 331 |
model_prompt_dict = load_model_prompt_dict()
|
| 332 |
|
| 333 |
|
| 334 |
+
def insert_model_recom_prompt(prompt: str = "", neg_prompt: str = "", model_name: str = "None", type = "Auto"):
|
| 335 |
+
enable_auto_recom_prompt = True if type == "Auto" else False
|
| 336 |
if not model_name or not enable_auto_recom_prompt: return prompt, neg_prompt
|
| 337 |
prompts = to_list(prompt)
|
| 338 |
neg_prompts = to_list(neg_prompt)
|