From 3d5e6ff0e5a5738cd5e0bb250c082754bf9c3056 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Sun, 25 Jun 2023 19:22:22 +0200 Subject: [PATCH 1/2] Added new templates more wildcards added notification message about whose prompt it used --- build_dynamic_prompt.py | 83 +++++++++++++++++++++++++++++--- csvfiles/brands.csv | 3 +- csvfiles/descriptors.csv | 3 +- csvfiles/human_activities.csv | 3 +- csvfiles/moods.csv | 6 ++- csvfiles/templates/templates.csv | 5 +- prompttester.py | 2 +- 7 files changed, 91 insertions(+), 14 deletions(-) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index b992016..baa0a77 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -94,6 +94,12 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all elif(artists != "none"): artistlist = csv_to_list("artists",antilist) + # create special artists lists, used in templates + fantasyartistlist = artist_category_csv_to_list("artists_and_category","fantasy") + popularartistlist = artist_category_csv_to_list("artists_and_category","popular") + romanticismartistlist = artist_category_csv_to_list("artists_and_category","romanticism") + photographyartistlist = artist_category_csv_to_list("artists_and_category","photography") + # add any other custom lists stylestiloralist = csv_to_list("styles_ti_lora",antilist,"./userfiles/") @@ -537,13 +543,14 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # targettemplateenvironment: either civitai model or website # templateenvironmentsources: either templateprompts = [templateprompt[0] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] - + templatepromptcreator = [templateprompt[1] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") ) ] templatesubjects= [templateprompt[4] for templateprompt in templatelist if( (templateprompt[1] == targettemplateenvironment or targettemplateenvironment =="all") and (templateprompt[2] == templateenvironmentsources or templateenvironmentsources == "all") and (templateprompt[3] == forcesubject or forcesubject == "all") )] # choose the template chosentemplate = random.choice(templateprompts) templateindex = templateprompts.index(chosentemplate) + print("Processing a prompt that was inspired from: " + templatepromptcreator[templateindex]) # if there is a subject override, then replace the subject with that if(givensubject==""): @@ -870,7 +877,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # start shot size if(mainchooser in ["object", "animal", "humanoid", "concept"] and othertype == 0 and "portrait" not in completeprompt and generateshot == True and uncommon_dist(insanitylevel)): - completeprompt += random.choice(shotsizelist) + " of a " + completeprompt += "-shotsize- of a " elif("portrait" in completeprompt and generateshot == True): completeprompt += " ,close up of a " elif(mainchooser in ["landscape"] and generateshot == True): @@ -1101,7 +1108,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # SD understands emoji's. Can be used to manipulate facial expressions. # emoji, legendary if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid"] and legendary_dist(insanitylevel) and generateemoji== True): - completeprompt += random.choice(emojilist) + ", " + completeprompt += "-emoji-, " # cosplaying @@ -1162,7 +1169,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # landscapes it is nice to always have a time period if(normal_dist(insanitylevel) or subjectchooser=="landscape"): if(generatetimeperiod == True): - completeprompt += random.choice(timeperiodlist) + ", " + completeprompt += "-timeperiod-, " if(mainchooser not in ["landscape"] and rare_dist(insanitylevel) and generatefocus == True): completeprompt += random.choice(focuslist) + ", " @@ -1470,9 +1477,68 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all # lol, this needs a rewrite :D - while "-color-" in completeprompt or "-material-" in completeprompt or "-animal-" in completeprompt or "-object-" in completeprompt or "-fictional-" in completeprompt or "-nonfictional-" in completeprompt or "-conceptsuffix-" in completeprompt or "-building-" in completeprompt or "-vehicle-" in completeprompt or "-outfit-" in completeprompt or "-location-" in completeprompt or "-conceptprefix-" in completeprompt or "-descriptor-" in completeprompt or "-food-" in completeprompt or "-haircolor-" in completeprompt or "-hairstyle-" in completeprompt or "-job-" in completeprompt or "-culture-" in completeprompt or "-accessory-" in completeprompt or "-humanoid-" in completeprompt or "-manwoman-" in completeprompt or "-human-" in completeprompt or "-colorscheme-" in completeprompt or "-mood-" in completeprompt or "-genderdescription-" in completeprompt or "-artmovement-" in completeprompt or "-malefemale-" in completeprompt or "-objecttotal-" in completeprompt or "-bodytype-" in completeprompt or "-minilocation-" in completeprompt or "-minilocationaddition-" in completeprompt or "-pose-" in completeprompt or "-season-" in completeprompt or "-minioutfit-" in completeprompt or "-elaborateoutfit-" in completeprompt or "-minivomit-" in completeprompt or "-vomit-" in completeprompt or "-rpgclass-" in completeprompt or "-subjectfromfile-" in completeprompt or "-brand-" in completeprompt or "-space-" in completeprompt or "-artist-" in completeprompt or "-imagetype-" in completeprompt or "-othertype-" in completeprompt or "-quality-" in completeprompt or "-lighting-" in completeprompt or "-camera-" in completeprompt or "-lens-" in completeprompt or "-imagetypequality-" in completeprompt or "-poemline-" in completeprompt or "-songline-" in completeprompt or "-greatwork-" in completeprompt: - allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-"] - allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist] + while ( + "-color-" in completeprompt or + "-material-" in completeprompt or + "-animal-" in completeprompt or + "-object-" in completeprompt or + "-fictional-" in completeprompt or + "-nonfictional-" in completeprompt or + "-conceptsuffix-" in completeprompt or + "-building-" in completeprompt or + "-vehicle-" in completeprompt or + "-outfit-" in completeprompt or + "-location-" in completeprompt or + "-conceptprefix-" in completeprompt or + "-descriptor-" in completeprompt or + "-food-" in completeprompt or + "-haircolor-" in completeprompt or + "-hairstyle-" in completeprompt or + "-job-" in completeprompt or + "-culture-" in completeprompt or + "-accessory-" in completeprompt or + "-humanoid-" in completeprompt or + "-manwoman-" in completeprompt or + "-human-" in completeprompt or + "-colorscheme-" in completeprompt or + "-mood-" in completeprompt or + "-genderdescription-" in completeprompt or + "-artmovement-" in completeprompt or + "-malefemale-" in completeprompt or + "-objecttotal-" in completeprompt or + "-bodytype-" in completeprompt or + "-minilocation-" in completeprompt or + "-minilocationaddition-" in completeprompt or + "-pose-" in completeprompt or + "-season-" in completeprompt or + "-minioutfit-" in completeprompt or + "-elaborateoutfit-" in completeprompt or + "-minivomit-" in completeprompt or + "-vomit-" in completeprompt or + "-rpgclass-" in completeprompt or + "-subjectfromfile-" in completeprompt or + "-brand-" in completeprompt or + "-space-" in completeprompt or + "-artist-" in completeprompt or + "-imagetype-" in completeprompt or + "-othertype-" in completeprompt or + "-quality-" in completeprompt or + "-lighting-" in completeprompt or + "-camera-" in completeprompt or + "-lens-" in completeprompt or + "-imagetypequality-" in completeprompt or + "-poemline-" in completeprompt or + "-songline-" in completeprompt or + "-greatwork-" in completeprompt or + "-artistfantasy-" in completeprompt or + "-artistpopular-" in completeprompt or + "-artistromanticism-" in completeprompt or + "-artistphotography-" in completeprompt or + "-emoji-" in completeprompt or + "-timeperiod-" in completeprompt or + "-shotsize-" in completeprompt): + allwildcardslistnohybrid = [ "-color-","-object-", "-animal-", "-fictional-","-nonfictional-","-building-","-vehicle-","-location-","-conceptprefix-","-food-","-haircolor-","-hairstyle-","-job-", "-accessory-", "-humanoid-", "-manwoman-", "-human-", "-colorscheme-", "-mood-", "-genderdescription-", "-artmovement-", "-malefemale-", "-bodytype-", "-minilocation-", "-minilocationaddition-", "-pose-", "-season-", "-minioutfit-", "-elaborateoutfit-", "-minivomit-", "-vomit-", "-rpgclass-", "-subjectfromfile-", "-brand-", "-space-", "-artist-", "-imagetype-", "-othertype-", "-quality-", "-lighting-", "-camera-", "-lens-","-imagetypequality-", "-poemline-", "-songline-", "-greatwork-", "-artistfantasy-", "-artistpopular-", "-artistromanticism-", "-artistphotography-", "-emoji-", "-timeperiod-", "-shotsize-"] + allwildcardslistnohybridlists = [colorlist, objectlist, animallist, fictionallist, nonfictionallist, buildinglist, vehiclelist, locationlist,conceptprefixlist,foodlist,haircolorlist, hairstylelist,joblist, accessorielist, humanoidlist, manwomanlist, humanlist, colorschemelist, moodlist, genderdescriptionlist, artmovementlist, malefemalelist, bodytypelist, minilocationlist, minilocationadditionslist, poselist, seasonlist, minioutfitlist, elaborateoutfitlist, minivomitlist, vomitlist, rpgclasslist, customsubjectslist, brandlist, spacelist, artistlist, imagetypelist, othertypelist, qualitylist, lightinglist, cameralist, lenslist, imagetypequalitylist, poemlinelist, songlinelist, greatworklist, fantasyartistlist, popularartistlist, romanticismartistlist, photographyartistlist, emojilist, timeperiodlist, shotsizelist] allwildcardslistwithhybrid = ["-material-", "-descriptor-", "-outfit-", "-conceptsuffix-","-culture-", "-objecttotal-"] allwildcardslistwithhybridlists = [materiallist, descriptorlist,outfitlist,conceptsuffixlist,culturelist, objecttotallist] @@ -1574,7 +1640,8 @@ def cleanup(completeprompt): completeprompt = re.sub('of a of a', 'of a', completeprompt) - + completeprompt = re.sub('(? Date: Sun, 25 Jun 2023 19:27:46 +0200 Subject: [PATCH 2/2] changed some words --- csvfiles/templates/templates.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csvfiles/templates/templates.csv b/csvfiles/templates/templates.csv index 3d0e242..6aae5e0 100644 --- a/csvfiles/templates/templates.csv +++ b/csvfiles/templates/templates.csv @@ -499,6 +499,6 @@ Upper body portrait of -descriptor- -malefemale- -subject-, -hairstyle- -haircol -culture- -rpgclass- -subject-, character design, league of legends, valorant, riot games, dota, full body concept art, detailed;openart;gallery;humanoid;-job- Closeup face portrait of a -descriptor- -malefemale- -culture- -subject-, -haircolor- hair, -fictional- headdress, smooth soft skin, big dreamy eyes, beautiful intricate jeweled hair, symmetrical, anime wide eyes, soft lighting, detailed face, by makoto shinkai, stanley artgerm lau, wlop, rossdraws, boris, sorayama, concept art, digital painting, looking into camera, straight on, 4k, hyperrealistic;openart;gallery;humanoid;-job- magical -subject- of -culture- glowing in universe -space-, octane render, 8k, extremely detailed;openart;gallery;object;-building- -Epic -artist- [detailed color pencil:photo shoot:0.3] by -artistfantasy- and (-artistromanticism-:0.5) and (-artistromanticism-:0.5), HQ, 8K, hyper detailed, The -subject- surrounded by -object-s (face looking -mood-:1.5), -descriptor-, -descriptor-, -descriptor-, -timeperiod-, timeless realization of the facts of life and our time is limited on this earth, Action, cinematic dramatic lighting, bokeh, shot on Canon 5D,masterpiece [oil painting:hyperrealism:0.3] in the style of (-artistphotography-:0.5);eric richards;offical;humanoid;-malefemale- -Epic realistic [detailed color pencil:photo shoot:0.3] by -artist- and (-artistfantasy-:0.5) and (-artistromanticism-:0.5) The beautiful -descriptor- -subject- surrounded by -descriptor- -object-s (face looking -mood-:1.2), -descriptor-, -descriptor-, -descriptor-, -timeperiod-, -location-, action shot -pose-, Action, cinematic dramatic lighting, dark, high contrast, bokeh, HQ, 8K, HDR, hyper detailed, -shotsize-, photograph shot on -camera-, masterpiece [oil painting:hyperrealism:0.3] photo in the style of (-artistphotography-:0.5);eric richards;offical;humanoid;-malefemale- --imagetypequality- 16k, 8k, 4k, 4k UHD, ultra HDR, perfect quality, insane quality, extreme quality, intricate, ultra quality, super quality, perfect detail, very high detail, insanely detailed, extremely detailed, intricate detail, ultra detail, super detail, perfect resolution, very high resolution, insane resolution, (cinematic shot:1.6), depth of field, rule of thirds, ((-artmovement-)) , (masterpiece art by -artist- ) and (-artistromanticism-:0.25) of -poemline- -descriptor- beautiful -subject- (face looking -mood-:1.3) surrounded by -object-s while -songline-, -timeperiod-, -descriptor-, -descriptor-, -descriptor-, cinematic dramatic lighting, bokeh, HQ, sharp focus, -shotsize-, DSLR photo, -imagetype-;eric richards;offical;humanoid;-malefemale- \ No newline at end of file +Epic -artist- [detailed color pencil:photo shoot:0.3] by -artistfantasy- and (-artistromanticism-:0.5) and (-artistromanticism-:0.5), HQ, 8K, hyper detailed, The -subject- surrounded by -objecttotal-s (face looking -mood-:1.5), -descriptor-, -descriptor-, -descriptor-, -timeperiod-, timeless realization of the facts of life and our time is limited on this earth, Action, cinematic dramatic lighting, bokeh, shot on Canon 5D,masterpiece [oil painting:hyperrealism:0.3] in the style of (-artistphotography-:0.5);eric richards;offical;humanoid;-malefemale- +Epic realistic [detailed color pencil:photo shoot:0.3] by -artist- and (-artistfantasy-:0.5) and (-artistromanticism-:0.5) The beautiful -descriptor- -subject- surrounded by -descriptor- -objecttotal-s (face looking -mood-:1.2), -descriptor-, -descriptor-, -descriptor-, -timeperiod-, -location-, action shot -pose-, Action, cinematic dramatic lighting, dark, high contrast, bokeh, HQ, 8K, HDR, hyper detailed, -shotsize-, photograph shot on -camera-, masterpiece [oil painting:hyperrealism:0.3] photo in the style of (-artistphotography-:0.5);eric richards;offical;humanoid;-malefemale- +-imagetypequality- 16k, 8k, 4k, 4k UHD, ultra HDR, perfect quality, insane quality, extreme quality, intricate, ultra quality, super quality, perfect detail, very high detail, insanely detailed, extremely detailed, intricate detail, ultra detail, super detail, perfect resolution, very high resolution, insane resolution, (cinematic shot:1.6), depth of field, rule of thirds, ((-artmovement-)) , (masterpiece art by -artist- ) and (-artistromanticism-:0.25) of -poemline- -descriptor- beautiful -subject- (face looking -mood-:1.3) surrounded by -objecttotal-s while -songline-, -timeperiod-, -descriptor-, -descriptor-, -descriptor-, cinematic dramatic lighting, bokeh, HQ, sharp focus, -shotsize-, DSLR photo, -imagetype-;eric richards;offical;humanoid;-malefemale- \ No newline at end of file