修改生成提示词处理
This commit is contained in:
+85
-41
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from .dataset import Dataset
|
||||
from .dataset import Dataset, JsonlDataset, JsonDataset
|
||||
from .config import config
|
||||
|
||||
|
||||
@@ -48,13 +48,27 @@ def buildClassifyPrompt(text):
|
||||
return text.replace(" ", "_") + "_prompt"
|
||||
|
||||
|
||||
# 构建数据
|
||||
def buildJsonDatas(text):
|
||||
return text.replace(" ", "_") + "_datas"
|
||||
|
||||
|
||||
# 构建提示词
|
||||
def buildJsonPrompt(text):
|
||||
return text.replace(" ", "_") + "_prompt"
|
||||
|
||||
|
||||
# 构建提示词
|
||||
class BuildPrompt:
|
||||
|
||||
def __init__(self, path):
|
||||
|
||||
self._dataset = Dataset(path)
|
||||
ext = os.path.splitext(path)[1]
|
||||
if ext.lower() == ".json":
|
||||
self._dataset = JsonDataset(path)
|
||||
else:
|
||||
self._dataset = JsonlDataset(path)
|
||||
|
||||
|
||||
def get_dataset(self):
|
||||
|
||||
@@ -81,7 +95,12 @@ class BuildPrompt:
|
||||
|
||||
def get_prompt(self, key):
|
||||
|
||||
return self._dataset[key] if key in self._dataset else ""
|
||||
prompt = ""
|
||||
datas = getattr(self._dataset, key, None)
|
||||
if datas is not None:
|
||||
prompt = datas["text"] if "text" in datas else ""
|
||||
|
||||
return prompt
|
||||
|
||||
|
||||
def generate_prompt(self, seed, styles="", artists=""):
|
||||
@@ -132,6 +151,14 @@ class BuildPromptManager:
|
||||
data_path = os.path.join(path, language, file_name)
|
||||
build_prompts[classify_prompt] = BuildPrompt(data_path)
|
||||
|
||||
for data_name in config.json_datas:
|
||||
|
||||
json_datas = buildJsonDatas(data_name)
|
||||
json_prompt = buildJsonPrompt(data_name)
|
||||
file_name = f"{json_datas}.json"
|
||||
data_path = os.path.join(path, language, file_name)
|
||||
build_prompts[json_prompt] = BuildPrompt(data_path)
|
||||
|
||||
return build_prompts
|
||||
|
||||
|
||||
@@ -165,6 +192,7 @@ class BuildPromptManager:
|
||||
eyebrows_style=EMPTY_OPTION,
|
||||
eyebrows_color=EMPTY_OPTION,
|
||||
eyelashs_style=EMPTY_OPTION,
|
||||
eyelashs_color=EMPTY_OPTION,
|
||||
nose_shape=EMPTY_OPTION,
|
||||
hair_style=EMPTY_OPTION,
|
||||
hair_color=EMPTY_OPTION,
|
||||
@@ -213,7 +241,7 @@ class BuildPromptManager:
|
||||
gender = ""
|
||||
|
||||
if androgynous_weight > 0:
|
||||
androgynous = self.androgynous_prompt.choice_prompt(seed)
|
||||
androgynous = self.portrait_prompt.get_prompt("androgynous")
|
||||
androgynous = buildPromptWeight(androgynous, androgynous_weight)
|
||||
else:
|
||||
androgynous = ""
|
||||
@@ -249,25 +277,25 @@ class BuildPromptManager:
|
||||
face_shape = ""
|
||||
|
||||
if pretty_face_weight > 0:
|
||||
pretty_face = self.pretty_face_prompt.choice_prompt(seed)
|
||||
pretty_face = self.portrait_prompt.get_prompt("pretty_face")
|
||||
pretty_face = buildPromptWeight(pretty_face, pretty_face_weight)
|
||||
else:
|
||||
pretty_face = ""
|
||||
|
||||
if ordinary_face_weight > 0:
|
||||
ordinary_face = self.ordinary_face_prompt.choice_prompt(seed)
|
||||
ordinary_face = self.portrait_prompt.get_prompt("ordinary_face")
|
||||
ordinary_face = buildPromptWeight(ordinary_face, ordinary_face_weight)
|
||||
else:
|
||||
ordinary_face = ''
|
||||
|
||||
if ugly_face_weight > 0:
|
||||
ugly_face = self.ugly_face_prompt.choice_prompt(seed)
|
||||
ugly_face = self.portrait_prompt.get_prompt("ugly_face")
|
||||
ugly_face = buildPromptWeight(ugly_face, ugly_face_weight)
|
||||
else:
|
||||
ugly_face = ""
|
||||
|
||||
if facial_asymmetry_weight > 0:
|
||||
facial_asymmetry = self.facial_asymmetry_prompt.choice_prompt(seed)
|
||||
facial_asymmetry = self.portrait_prompt.get_prompt("facial_asymmetry")
|
||||
facial_asymmetry = buildPromptWeight(facial_asymmetry, facial_asymmetry_weight)
|
||||
else:
|
||||
facial_asymmetry = ""
|
||||
@@ -323,6 +351,14 @@ class BuildPromptManager:
|
||||
else:
|
||||
eyelashs_style = ""
|
||||
|
||||
if eyelashs_color == RANDOM_OPTION:
|
||||
eyelashs_color = self.eyelashs_color_prompt.choice_prompt(seed)
|
||||
eyelashs_color = buildPromptWeight(eyelashs_color, 1.05)
|
||||
elif eyelashs_color != EMPTY_OPTION:
|
||||
eyelashs_color = buildPromptWeight(eyelashs_color, 1.05)
|
||||
else:
|
||||
eyelashs_color = ""
|
||||
|
||||
if nose_shape == RANDOM_OPTION:
|
||||
nose_shape = self.nose_shape_prompt.choice_prompt(seed)
|
||||
nose_shape = buildPromptWeight(nose_shape, 1.05)
|
||||
@@ -356,7 +392,7 @@ class BuildPromptManager:
|
||||
hair_length = ""
|
||||
|
||||
if disheveled_weight > 0:
|
||||
disheveled = self.disheveled_prompt.choice_prompt(seed)
|
||||
disheveled = self.portrait_prompt.get_prompt("disheveled")
|
||||
disheveled = buildPromptWeight(disheveled, disheveled_weight)
|
||||
else:
|
||||
disheveled = ""
|
||||
@@ -413,7 +449,7 @@ class BuildPromptManager:
|
||||
lens_angle,
|
||||
nationality, gender, androgynous, age, body_type,
|
||||
face_shape, pretty_face, ordinary_face, ugly_face, facial_asymmetry, facial_expression,
|
||||
eyes_shape, eyes_color, eyebrows_style, eyebrows_color, eyelashs_style,
|
||||
eyes_shape, eyes_color, eyebrows_style, eyebrows_color, eyelashs_style, eyelashs_color,
|
||||
nose_shape,
|
||||
hair_style, hair_color, hair_length, disheveled,
|
||||
mouth_shape,
|
||||
@@ -461,56 +497,56 @@ class BuildPromptManager:
|
||||
if skin_weight > 0:
|
||||
if skin == RANDOM_OPTION:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), skin_weight))
|
||||
elif skin == EMPTY_OPTION:
|
||||
elif skin != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(skin, skin_weight))
|
||||
|
||||
if skin_details_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), skin_details_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("skin_details"), skin_details_weight))
|
||||
|
||||
if skin_pores_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), skin_pores_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("skin_pores"), skin_pores_weight))
|
||||
|
||||
if skin_imperfections_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), skin_imperfections_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("skin_imperfections"), skin_imperfections_weight))
|
||||
|
||||
if skin_acne_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), skin_acne_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("skin_acne"), skin_acne_weight))
|
||||
|
||||
if tanned_skin_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), tanned_skin_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("tanned_skin"), tanned_skin_weight))
|
||||
|
||||
if bare_face_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), bare_face_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("bare_face"), bare_face_weight))
|
||||
|
||||
if moist_face_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), moist_face_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("moist_face"), moist_face_weight))
|
||||
|
||||
if dried_face_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), dried_face_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("dried_face"), dried_face_weight))
|
||||
|
||||
if dimples_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), dimples_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("dimples"), dimples_weight))
|
||||
|
||||
if wrinkles_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), wrinkles_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("wrinkles"), wrinkles_weight))
|
||||
|
||||
if freckles_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), freckles_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("freckles"), freckles_weight))
|
||||
|
||||
if moles_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), moles_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("moles"), moles_weight))
|
||||
|
||||
if eyes_details_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), eyes_details_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("eyes_details"), eyes_details_weight))
|
||||
|
||||
if circular_pupil_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), circular_pupil_weight))
|
||||
if circular_pupils_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("circular_pupil"), circular_pupils_weight))
|
||||
|
||||
if iris_details_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), iris_details_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("iris_details"), iris_details_weight))
|
||||
|
||||
if circular_iris_weight > 0:
|
||||
prompt_words.append(buildPromptWeight(self.skin_prompt.choice_prompt(seed), circular_iris_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("circular_iris"), circular_iris_weight))
|
||||
|
||||
|
||||
output_prompt = ""
|
||||
@@ -524,10 +560,12 @@ class BuildPromptManager:
|
||||
def generate_portrait_fashion_prompt(self,
|
||||
clothes=EMPTY_OPTION,
|
||||
clothes_weight=1,
|
||||
clothes_color=EMPTY_OPTION,
|
||||
clothes_color_weight=0,
|
||||
up_clothes=EMPTY_OPTION,
|
||||
up_clothes_weight=0,
|
||||
down_chothes=EMPTY_OPTION,
|
||||
down_chothes_weight=0,
|
||||
down_clothes=EMPTY_OPTION,
|
||||
down_clothes_weight=0,
|
||||
trousers=EMPTY_OPTION,
|
||||
trousers_weight=0,
|
||||
underwear=EMPTY_OPTION,
|
||||
@@ -557,17 +595,23 @@ class BuildPromptManager:
|
||||
elif clothes != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(clothes, clothes_weight))
|
||||
|
||||
if clothes_color_weight > 0:
|
||||
if clothes_color == RANDOM_OPTION:
|
||||
prompt_words.append(buildPromptWeight(self.clothes_color_prompt.choice_prompt(seed), clothes_color_weight))
|
||||
elif clothes_color != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(clothes_color, clothes_color_weight))
|
||||
|
||||
if up_clothes_weight > 0:
|
||||
if up_clothes == RANDOM_OPTION:
|
||||
prompt_words.append(buildPromptWeight(self.up_clothes_prompt.choice_prompt(seed), up_clothes_weight))
|
||||
elif up_clothes != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(up_clothes, up_clothes_weight))
|
||||
|
||||
if down_chothes_weight > 0:
|
||||
if down_chothes == RANDOM_OPTION:
|
||||
prompt_words.append(buildPromptWeight(self.down_chothes_prompt.choice_prompt(seed), down_chothes_weight))
|
||||
elif down_chothes != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(down_chothes, down_chothes_weight))
|
||||
if down_clothes_weight > 0:
|
||||
if down_clothes== RANDOM_OPTION:
|
||||
prompt_words.append(buildPromptWeight(self.down_clothes_prompt.choice_prompt(seed), down_clothes_weight))
|
||||
elif down_clothes != EMPTY_OPTION:
|
||||
prompt_words.append(buildPromptWeight(down_clothes, down_clothes_weight))
|
||||
|
||||
if trousers_weight > 0:
|
||||
if trousers == RANDOM_OPTION:
|
||||
@@ -724,22 +768,22 @@ class BuildPromptManager:
|
||||
prompt_words.append(buildPromptWeight(makeup_color, makeup_color_weight))
|
||||
|
||||
if eyeshadow_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("eyeshadow make-up", eyeshadow_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("eyeshadow_make_up"), eyeshadow_weight))
|
||||
|
||||
if eyeliner_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("eyeliner make-up", eyeliner_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("eyeliner_make_up"), eyeliner_weight))
|
||||
|
||||
if mascara_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("mascara make-up", mascara_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("mascara_make_up"), mascara_weight))
|
||||
|
||||
if blush_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("blush make-up", blush_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("blush_make_up"), blush_weight))
|
||||
|
||||
if lipstick_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("lipstick make-up", lipstick_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("lipstick_make_up"), lipstick_weight))
|
||||
|
||||
if lip_gloss_weight > 0:
|
||||
prompt_words.append(buildPromptWeight("lip gloss make-up", lip_gloss_weight))
|
||||
prompt_words.append(buildPromptWeight(self.portrait_prompt.get_prompt("lip_gloss_make_up"), lip_gloss_weight))
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
|
||||
+49
-9
@@ -3,6 +3,16 @@ import json
|
||||
|
||||
# dataset
|
||||
class Dataset:
|
||||
def __init__(self, data_path):
|
||||
pass
|
||||
|
||||
def load_data(self, path):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# jsonl dataset
|
||||
class JsonlDataset(Dataset):
|
||||
def __init__(self, data_path):
|
||||
|
||||
self.sample_datas = self.load_data(data_path)
|
||||
@@ -11,8 +21,8 @@ class Dataset:
|
||||
def load_data(self, path):
|
||||
|
||||
sample_datas = []
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
for line_num, line in enumerate(f, 1):
|
||||
with open(path, 'r', encoding='utf-8') as fp:
|
||||
for line_num, line in enumerate(fp, 1):
|
||||
if line != "":
|
||||
try:
|
||||
data = json.loads(line.strip())
|
||||
@@ -20,16 +30,14 @@ class Dataset:
|
||||
except:
|
||||
print("jsonl file parse error:", path)
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
||||
return sample_datas
|
||||
|
||||
|
||||
|
||||
|
||||
def __len__(self):
|
||||
|
||||
return len(self.sample_datas)
|
||||
|
||||
|
||||
|
||||
def __getitem__(self, index):
|
||||
|
||||
@@ -38,4 +46,36 @@ class Dataset:
|
||||
style = str(sample_data["style"]) if "style" in sample_data else None
|
||||
artist = str(sample_data["artist"]) if "artist" in sample_data else None
|
||||
|
||||
return text, style, artist
|
||||
return text, style, artist
|
||||
|
||||
|
||||
|
||||
# json dataset
|
||||
class JsonDataset(Dataset):
|
||||
def __init__(self, data_path):
|
||||
|
||||
self.sample_datas = self.load_data(data_path)
|
||||
|
||||
|
||||
def load_data(self, path):
|
||||
|
||||
sample_datas = {}
|
||||
with open(path, 'r', encoding='utf-8') as fp:
|
||||
try:
|
||||
sample_datas = json.load(fp)
|
||||
except:
|
||||
print("json file parse error:", path)
|
||||
|
||||
return sample_datas
|
||||
|
||||
|
||||
def __len__(self):
|
||||
|
||||
return len(self.sample_datas)
|
||||
|
||||
|
||||
def __getattr__(self, key):
|
||||
|
||||
return self.sample_datas[key] if key in self.sample_datas else None
|
||||
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@ class GeneratePrompt:
|
||||
|
||||
if ainput_prompt != "":
|
||||
prompt_words.append(ainput_prompt)
|
||||
|
||||
if preset_prefix != "":
|
||||
prompt_words.append(preset_prefix)
|
||||
|
||||
if classify != EMPTY_OPTION:
|
||||
# 获取Script的目录路径
|
||||
@@ -61,16 +58,15 @@ class GeneratePrompt:
|
||||
build = BuildPrompt(data_file)
|
||||
prompt = build.generate_prompt(seed)
|
||||
|
||||
prompt = preset_prefix + prompt + preset_suffix
|
||||
if prompt != "":
|
||||
prompt_words.append(prompt)
|
||||
|
||||
if preset_suffix != "":
|
||||
prompt_words.append(preset_suffix)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ class LightPrompt:
|
||||
if light_prompt != "":
|
||||
prompt_words.append(light_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
+49
-23
@@ -148,6 +148,10 @@ class PortraitPrompt:
|
||||
"eyelashs_style": (buildOptionList(build_prompt_manager.eyelashs_style_prompt.get_dataset()), {
|
||||
"default": DEFAULT_OPTION,
|
||||
}),
|
||||
# 睫毛颜色
|
||||
"eyelashs_color": (buildOptionList(build_prompt_manager.eyelashs_color_prompt.get_dataset()), {
|
||||
"default": DEFAULT_OPTION,
|
||||
}),
|
||||
# 鼻子形状
|
||||
"nose_shape": (buildOptionList(build_prompt_manager.nose_shape_prompt.get_dataset()), {
|
||||
"default": DEFAULT_OPTION,
|
||||
@@ -241,6 +245,7 @@ class PortraitPrompt:
|
||||
eyebrows_style=EMPTY_OPTION,
|
||||
eyebrows_color=EMPTY_OPTION,
|
||||
eyelashs_style=EMPTY_OPTION,
|
||||
eyelashs_color=EMPTY_OPTION,
|
||||
nose_shape=EMPTY_OPTION,
|
||||
hair_style=EMPTY_OPTION,
|
||||
hair_color=EMPTY_OPTION,
|
||||
@@ -294,6 +299,7 @@ class PortraitPrompt:
|
||||
eyebrows_style=eyebrows_style,
|
||||
eyebrows_color=eyebrows_color,
|
||||
eyelashs_style=eyelashs_style,
|
||||
eyelashs_color=eyelashs_color,
|
||||
nose_shape=nose_shape,
|
||||
hair_style=hair_style,
|
||||
hair_color=hair_color,
|
||||
@@ -311,11 +317,11 @@ class PortraitPrompt:
|
||||
if portrait_prompt != "":
|
||||
prompt_words.append(portrait_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
|
||||
@@ -545,7 +551,7 @@ class PortraitSkinPrompt:
|
||||
freckles_weight=freckles_weight,
|
||||
moles_weight=moles_weight,
|
||||
eyes_details_weight=eyes_details_weight,
|
||||
circular_pupil_weight=circular_pupil_weight,
|
||||
circular_pupils_weight=circular_pupils_weight,
|
||||
iris_details_weight=iris_details_weight,
|
||||
circular_iris_weight=circular_iris_weight,
|
||||
seed=seed
|
||||
@@ -554,11 +560,11 @@ class PortraitSkinPrompt:
|
||||
if skin_prompt != "":
|
||||
prompt_words.append(skin_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
|
||||
@@ -587,6 +593,18 @@ class PortraitFashionPrompt:
|
||||
"step": 0.05,
|
||||
"display": "slider",
|
||||
}),
|
||||
# 衣服颜色
|
||||
"clothes_color": (buildOptionList(build_prompt_manager.clothes_color_prompt.get_dataset()), {
|
||||
"default": EMPTY_OPTION,
|
||||
}),
|
||||
# 衣服颜色权重
|
||||
"clothes_color_weight": ("FLOAT", {
|
||||
"default": 1,
|
||||
"min": 0,
|
||||
"max": max_float_value,
|
||||
"step": 0.05,
|
||||
"display": "slider",
|
||||
}),
|
||||
# 上衣
|
||||
"up_clothes": (buildOptionList(build_prompt_manager.up_clothes_prompt.get_dataset()), {
|
||||
"default": EMPTY_OPTION,
|
||||
@@ -600,11 +618,11 @@ class PortraitFashionPrompt:
|
||||
"display": "slider",
|
||||
}),
|
||||
# 下衣
|
||||
"down_chothes": (buildOptionList(build_prompt_manager.down_chothes_prompt.get_dataset()), {
|
||||
"down_clothes": (buildOptionList(build_prompt_manager.down_clothes_prompt.get_dataset()), {
|
||||
"default": EMPTY_OPTION,
|
||||
}),
|
||||
# 下衣权重
|
||||
"down_chothes_weight": ("FLOAT", {
|
||||
"down_clothes_weight": ("FLOAT", {
|
||||
"default": 1,
|
||||
"min": 0,
|
||||
"max": max_float_value,
|
||||
@@ -745,10 +763,12 @@ class PortraitFashionPrompt:
|
||||
language="",
|
||||
clothes=EMPTY_OPTION,
|
||||
clothes_weight=1,
|
||||
clothes_color=EMPTY_OPTION,
|
||||
clothes_color_weight=0,
|
||||
up_clothes=EMPTY_OPTION,
|
||||
up_clothes_weight=0,
|
||||
down_chothes=EMPTY_OPTION,
|
||||
down_chothes_weight=0,
|
||||
down_clothes=EMPTY_OPTION,
|
||||
down_clothes_weight=0,
|
||||
trousers=EMPTY_OPTION,
|
||||
trousers_weight=0,
|
||||
underwear=EMPTY_OPTION,
|
||||
@@ -788,10 +808,12 @@ class PortraitFashionPrompt:
|
||||
fashion_prompt = build_prompt_manager.generate_portrait_fashion_prompt(
|
||||
clothes=clothes,
|
||||
clothes_weight=clothes_weight,
|
||||
clothes_color=clothes_color,
|
||||
clothes_color_weight=clothes_color_weight,
|
||||
up_clothes=up_clothes,
|
||||
up_clothes_weight=up_clothes_weight,
|
||||
down_chothes=down_chothes,
|
||||
down_chothes_weight=down_chothes_weight,
|
||||
down_clothes=down_clothes,
|
||||
down_clothes_weight=down_clothes_weight,
|
||||
trousers=trousers,
|
||||
trousers_weight=trousers_weight,
|
||||
underwear=underwear,
|
||||
@@ -816,11 +838,12 @@ class PortraitFashionPrompt:
|
||||
if fashion_prompt != "":
|
||||
prompt_words.append(fashion_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -981,11 +1004,13 @@ class PortraitPosePrompt:
|
||||
if pose_prompt != "":
|
||||
prompt_words.append(pose_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
|
||||
|
||||
# Portrait Cosmetics Prompt 人像化妆提示词
|
||||
@@ -1122,7 +1147,7 @@ class PortraitCosmeticPrompt:
|
||||
prompt_words.append(preset_prompt)
|
||||
|
||||
if enable == True:
|
||||
cosmetic_prompt = generate_portrait_cosmetic_prompt(
|
||||
cosmetic_prompt = build_prompt_manager.generate_portrait_cosmetic_prompt(
|
||||
makeup_style=makeup_style,
|
||||
makeup_style_weight=makeup_style_weight,
|
||||
makeup_color=makeup_color,
|
||||
@@ -1139,8 +1164,9 @@ class PortraitCosmeticPrompt:
|
||||
if cosmetic_prompt != "":
|
||||
prompt_words.append(cosmetic_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
+6
-11
@@ -5,11 +5,11 @@ from ..modules.config import config
|
||||
|
||||
|
||||
styles = [
|
||||
"none", "all"
|
||||
EMPTY_OPTION, RANDOM_OPTION
|
||||
]
|
||||
|
||||
artists = [
|
||||
"none", "all", "popular", "greg mode", "3D", "abstract", "angular",
|
||||
EMPTY_OPTION, RANDOM_OPTION, "popular", "greg mode", "3D", "abstract", "angular",
|
||||
"anime", "architecture", "art nouveau", "art deco", "baroque", "bauhaus", "cartoon",
|
||||
"character", "children's illustration", "cityscape", "cinema", "clean", "cloudscape",
|
||||
"collage", "colorful", "comics", "cubism", "dark", "detailed", "digital", "expressionism",
|
||||
@@ -79,18 +79,13 @@ class SceneryPrompt:
|
||||
if input_prompt != "":
|
||||
prompt_words.append(input_prompt)
|
||||
|
||||
if preset_prefix != "":
|
||||
prompt_words.append(preset_prefix)
|
||||
|
||||
scenery_prompt = preset_prefix + scenery_prompt + preset_suffix
|
||||
if scenery_prompt != "":
|
||||
prompt_words.append(scenery_prompt)
|
||||
|
||||
if preset_suffix != "":
|
||||
prompt_words.append(preset_suffix)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
|
||||
@@ -145,8 +145,9 @@ class DrawStylePrompt:
|
||||
if draw_style_prompt != "":
|
||||
prompt_words.append(draw_style_prompt)
|
||||
|
||||
output_prompt = ""
|
||||
if len(prompt_words) > 0:
|
||||
output_prompt = ", ".join(prompt_words)
|
||||
return (output_prompt, )
|
||||
else:
|
||||
return ("", )
|
||||
|
||||
return (output_prompt, )
|
||||
|
||||
Reference in New Issue
Block a user