Adding feature parity for some things for comfyUI

Added option to turn off emoji's, that break some stuff on ComfyUI
This commit is contained in:
AIrjen
2023-08-18 15:57:49 +02:00
parent 9dafdba0c3
commit 0d4fd185a9
5 changed files with 166 additions and 13 deletions
+153 -6
View File
@@ -10,16 +10,162 @@ onebuttonprompt_path = os.path.join(custom_nodes_path, "OneButtonPrompt")
sys.path.append(onebuttonprompt_path)
from build_dynamic_prompt import *
from csv_reader import *
artists = ["all", "none", "popular", "greg mode", "3D", "abstract", "angular", "anime" ,"architecture", "art nouveau", "art deco", "baroque", "bauhaus", "cartoon", "character", "children's illustration", "cityscape", "clean", "cloudscape", "collage", "colorful", "comics", "cubism", "dark", "detailed", "digital", "expressionism", "fantasy", "fashion", "fauvism", "figurativism", "gore", "graffiti", "graphic design", "high contrast", "horror", "impressionism", "installation", "landscape", "light", "line drawing", "low contrast", "luminism", "magical realism", "manga", "melanin", "messy", "monochromatic", "nature", "nudity", "photography", "pop art", "portrait", "primitivism", "psychedelic", "realism", "renaissance", "romanticism", "scene", "sci-fi", "sculpture", "seascape", "space", "stained glass", "still life", "storybook realism", "street art", "streetscape", "surrealism", "symbolism", "textile", "ukiyo-e", "vibrant", "watercolor", "whimsical"]
imagetypes = ["all", "all - force multiple", "photograph", "octane render","digital art","concept art", "painting", "portrait", "anime key visual", "only other types", "only templates mode", "art blaster mode", "quality vomit mode", "color cannon mode", "unique art mode", "massive madness mode", "photo fantasy mode", "subject only mode", "fixed styles mode"]
subjects =["all", "object", "animal", "humanoid", "landscape", "concept"]
genders = ["all", "male", "female"]
emojis = [False, True]
subjectsubtypesobject = ["all", "generic objects", "vehicles", "food", "buildings", "space", "flora"]
subjectsubtypeshumanoid = ["all", "generic humans", "generic human relations", "celebrities e.a.", "fictional characters", "humanoids", "based on job or title", "based on first name"]
subjectsubtypesconcept = ["all", "event", "the X of Y concepts", "lines from poems", "lines from songs"]
subjects =["all"]
subjectsubtypesobject = ["all"]
subjectsubtypeshumanoid = ["all"]
subjectsubtypesconcept = ["all"]
#subjectsubtypesobject = ["all", "generic objects", "vehicles", "food", "buildings", "space", "flora"]
#subjectsubtypeshumanoid = ["all", "generic humans", "generic human relations", "celebrities e.a.", "fictional characters", "humanoids", "based on job or title", "based on first name"]
#subjectsubtypesconcept = ["all", "event", "the X of Y concepts", "lines from poems", "lines from songs"]
# Load up stuff for personal artists list, if any
# find all artist files starting with personal_artits in userfiles
script_dir = os.path.dirname(os.path.abspath(__file__)) # Script directory
userfilesfolder = os.path.join(script_dir, "./userfiles/" )
for filename in os.listdir(userfilesfolder):
if(filename.endswith(".csv") and filename.startswith("personal_artists") and filename != "personal_artists_sample.csv"):
name = os.path.splitext(filename)[0]
name = name.replace("_"," ",-1).lower()
# directly insert into the artists list
artists.insert(2, name)
# on startup, check if we have a config file, or else create it
config = load_config_csv()
# load subjects stuff from config
generatevehicle = True
generateobject = True
generatefood = True
generatebuilding = True
generatespace = True
generateflora = True
generateanimal = True
generatemanwoman = True
generatemanwomanrelation = True
generatefictionalcharacter = True
generatenonfictionalcharacter = True
generatehumanoids = True
generatejob = True
generatefirstnames = True
generatelandscape = True
generateevent = True
generateconcepts = True
generatepoemline = True
generatesongline = True
for item in config:
# objects
if item[0] == 'subject_vehicle' and item[1] != 'on':
generatevehicle = False
if item[0] == 'subject_object' and item[1] != 'on':
generateobject = False
if item[0] == 'subject_food' and item[1] != 'on':
generatefood = False
if item[0] == 'subject_building' and item[1] != 'on':
generatebuilding = False
if item[0] == 'subject_space' and item[1] != 'on':
generatespace = False
if item[0] == 'subject_flora' and item[1] != 'on':
generateflora = False
# animals
if item[0] == 'subject_animal' and item[1] != 'on':
generateanimal = False
# humanoids
if item[0] == 'subject_manwoman' and item[1] != 'on':
generatemanwoman = False
if item[0] == 'subject_manwomanrelation' and item[1] != 'on':
generatemanwomanrelation = False
if item[0] == 'subject_fictional' and item[1] != 'on':
generatefictionalcharacter = False
if item[0] == 'subject_nonfictional' and item[1] != 'on':
generatenonfictionalcharacter = False
if item[0] == 'subject_humanoid' and item[1] != 'on':
generatehumanoids = False
if item[0] == 'subject_job' and item[1] != 'on':
generatejob = False
if item[0] == 'subject_firstnames' and item[1] != 'on':
generatefirstnames = False
# landscape
if item[0] == 'subject_landscape' and item[1] != 'on':
generatelandscape = False
# concept
if item[0] == 'subject_event' and item[1] != 'on':
generateevent = False
if item[0] == 'subject_concept' and item[1] != 'on':
generateconcepts = False
if item[0] == 'poemline' and item[1] != 'on':
generatepoemline = False
if item[0] == 'songline' and item[1] != 'on':
generatesongline = False
# build up all subjects we can choose based on the loaded config file
if(generatevehicle or generateobject or generatefood or generatebuilding or generatespace):
subjects.append("object")
if(generateanimal):
subjects.append("animal")
if(generatemanwoman or generatemanwomanrelation or generatefictionalcharacter or generatenonfictionalcharacter or generatehumanoids or generatejob):
subjects.append("humanoid")
if(generatelandscape):
subjects.append("landscape")
if(generateevent or generateconcepts or generatepoemline or generatesongline):
subjects.append("concept")
# do the same for the subtype subjects
# subjectsubtypesobject = ["all"]
# subjectsubtypeshumanoid = ["all"]
# subjectsubtypesconcept = ["all"]
# objects first
if(generateobject):
subjectsubtypesobject.append("generic objects")
if(generatevehicle):
subjectsubtypesobject.append("vehicles")
if(generatefood):
subjectsubtypesobject.append("food")
if(generatebuilding):
subjectsubtypesobject.append("buildings")
if(generatespace):
subjectsubtypesobject.append("space")
if(generateflora):
subjectsubtypesobject.append("flora")
# humanoids (should I review descriptions??)
if(generatemanwoman):
subjectsubtypeshumanoid.append("generic humans")
if(generatemanwomanrelation):
subjectsubtypeshumanoid.append("generic human relations")
if(generatenonfictionalcharacter):
subjectsubtypeshumanoid.append("celebrities e.a.")
if(generatefictionalcharacter):
subjectsubtypeshumanoid.append("fictional characters")
if(generatehumanoids):
subjectsubtypeshumanoid.append("humanoids")
if(generatejob):
subjectsubtypeshumanoid.append("based on job or title")
if(generatefirstnames):
subjectsubtypeshumanoid.append("based on first name")
# concepts
if(generateevent):
subjectsubtypesconcept.append("event")
if(generateconcepts):
subjectsubtypesconcept.append("the X of Y concepts")
if(generatepoemline):
subjectsubtypesconcept.append("lines from poems")
if(generatesongline):
subjectsubtypesconcept.append("lines from songs")
class OneButtonPrompt:
@@ -57,6 +203,7 @@ class OneButtonPrompt:
"subject_subtypes_humanoids": (subjectsubtypeshumanoid, {"default": "all"}),
"humanoids_gender": (genders, {"default": "all"}),
"subject_subtypes_concepts": (subjectsubtypesconcept, {"default": "all"}),
"emojis":(emojis, {"default": False}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}),
},
@@ -71,8 +218,8 @@ class OneButtonPrompt:
CATEGORY = "OneButtonPrompt"
def Comfy_OBP(self, insanitylevel, custom_subject,seed, artist,imagetype, subject, imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts):
generatedprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False)
def Comfy_OBP(self, insanitylevel, custom_subject,seed, artist,imagetype, subject, imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, emojis):
generatedprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype,False,"","","",1,"",custom_subject,True,"",imagemodechance, humanoids_gender, subject_subtype_objects, subject_subtypes_humanoids, subject_subtypes_concepts, False, emojis)
#print(generatedprompt)
return (generatedprompt,)