From 37aa4a963e78f51353657a33fe1de6b0b66ee490 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Wed, 20 Mar 2024 20:47:15 +0100 Subject: [PATCH] finished artify, added flufferizer --- artifytester.py | 3 +- build_dynamic_prompt.py | 122 ++++++++++++++++++++++++++++++++++--- csvfiles/antifluff.csv | 99 ++++++++++++++++++++++++++++++ csvfiles/fluff.csv | 130 ++++++++++++++++++++++++++++++++++++++++ prompttester.py | 4 +- 5 files changed, 347 insertions(+), 11 deletions(-) create mode 100644 csvfiles/antifluff.csv create mode 100644 csvfiles/fluff.csv diff --git a/artifytester.py b/artifytester.py index 767d81b..f64ab1c 100644 --- a/artifytester.py +++ b/artifytester.py @@ -21,6 +21,7 @@ def generateprompts(amount = 1,prompt = "",artists="all",amountofartists = "1", result = build_dynamic_prompt(insanitylevel=3) else: result = artify_prompt(prompt=prompt, artists=artists, amountofartists=amountofartists, mode=mode) + result = flufferizer(prompt=result, reverse_polarity=True) print("ARTIFY COMPLETE: " + result) print("") print("loop " + str(steps)) @@ -33,4 +34,4 @@ def generateprompts(amount = 1,prompt = "",artists="all",amountofartists = "1", print("") print("All done!") -generateprompts(10,"a norwegian forest cat", "popular","3", "standard") \ No newline at end of file +generateprompts(10,"a norwegian forest cat", "all","random", "standard") \ No newline at end of file diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 6ece9f3..2b84bca 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -826,6 +826,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all stylesmode = False thetokinatormode = False dynamictemplatesmode = False + artifymode = False # determine wether we should go for a template or not. Not hooked up to insanitylevel if(imagetype == "only templates mode"): @@ -887,6 +888,12 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all dynamictemplatesmode = True print("Running with dynamic templates mode") + if(imagetype == "artify mode"): + specialmode = True + onlysubjectmode = True + artifymode = True + print("Running with artify mode") + # main stuff generatetype = not specialmode generatesubject = not templatemode @@ -1104,7 +1111,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all subjectchooser = "" mainchooser = "" - completeprompt += prefixprompt + #completeprompt += prefixprompt completeprompt += ", " @@ -2853,10 +2860,20 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all completeprompt += ", " + chosenstylesuffixcomplete - + if(artifymode == True): + amountofartists = "random" + if(unique_dist(insanitylevel)): + mode = "super remix turbo" + elif(legendary_dist(insanitylevel)): + mode = "remix" + else: + mode = "standard" + completeprompt = artify_prompt(insanitylevel=insanitylevel,prompt=completeprompt, artists=artists, amountofartists=amountofartists, mode=mode, seed=seed) completeprompt += " -tempnewwords- " completeprompt += ", " + + completeprompt = prefixprompt + ", " + completeprompt completeprompt += suffixprompt # and then up the compounding stuff @@ -4003,7 +4020,8 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy artiststyle.remove(chosenartiststyle) if("-artistmedium-" in completeprompt): - completeprompt = completeprompt.replace("-artistmedium-",artistmediums[0] ,1) + if(artistmediums[0].lower() not in completeprompt.lower()): + completeprompt = completeprompt.replace("-artistmedium-",artistmediums[0] ,1) if("-artistdescription-" in completeprompt): completeprompt = completeprompt.replace("-artistdescription-",artistdescriptions[0] ,1) @@ -4244,8 +4262,21 @@ def enhance_positive(positive_prompt = "", amountofwords = 3): return addwords -def artify_prompt(prompt = "", artists = "all", amountofartists = "1", mode="standard"): - intamountofartists = int(amountofartists) +def artify_prompt(insanitylevel = 5, prompt = "", artists = "all", amountofartists = "1", mode="standard", seed = -1): + if(amountofartists=="random"): + intamountofartists = random.randint(1,int((insanitylevel/3) + 1.20)) + else: + intamountofartists = int(amountofartists) + + + # set seed + # For use in ComfyUI (might bring to Automatic1111 as well) + # lets do it when its larger than 0 + # Otherwise, just do nothing and it will keep on working based on an earlier set seed + if(seed > 0): + random.seed(seed) + + # first build up a complete anti list. Those values are removing during list building # this uses the antivalues string AND the antilist.csv emptylist = [] @@ -4276,7 +4307,23 @@ def artify_prompt(prompt = "", artists = "all", amountofartists = "1", mode="sta artistlist = csv_to_list("artists",antilist) - completeprompt = "art by " + # load up the styles list for the other modes + styleslist = csv_to_list("styles", antilist,"./csvfiles/templates/",0,"?") + stylessuffix = [item.split('-subject-')[1] for item in styleslist] + breakstylessuffix = [item.split(',') for item in stylessuffix] + allstylessuffixlist = [value for sublist in breakstylessuffix for value in sublist] + allstylessuffixlist = list(set(allstylessuffixlist)) + + artistsuffix = artist_descriptions_csv_to_list("artists_and_category") + breakartiststylessuffix = [item.split(',') for item in artistsuffix] + artiststylessuffixlist = [value for sublist in breakartiststylessuffix for value in sublist] + artiststylessuffixlist = list(set(artiststylessuffixlist)) + allstylessuffixlist += artiststylessuffixlist + + completeprompt = "" + if(common_dist(insanitylevel)): + completeprompt += "-artiststyle- " + completeprompt += "art by " #Lets go effing artify this MF'er for i in range(0,intamountofartists): @@ -4285,11 +4332,27 @@ def artify_prompt(prompt = "", artists = "all", amountofartists = "1", mode="sta else: completeprompt += "-artist-, " + if(uncommon_dist(insanitylevel)): + completeprompt += "-artistmedium-, " + # now add the prompt in completeprompt += prompt - for i in range(0,intamountofartists): - completeprompt += ", -artistdescription-" + if(mode.lower() == "remix"): + for i in range(0,intamountofartists): + completeprompt += ", " + artistsuffix.pop(artistsuffix.index(random.choice(artistsuffix))) + + elif(mode.lower() == "super remix turbo"): + for i in range(0,intamountofartists*4): + completeprompt += ", " + allstylessuffixlist.pop(allstylessuffixlist.index(random.choice(allstylessuffixlist))) + + else: + # else just go standard + for i in range(0,intamountofartists): + completeprompt += ", -artistdescription-" + + + while ("-artist-" in completeprompt): @@ -4299,6 +4362,49 @@ def artify_prompt(prompt = "", artists = "all", amountofartists = "1", mode="sta return completeprompt +def flufferizer(prompt = "", amountoffluff = "dynamic", seed = -1, reverse_polarity = False): + # set seed + # For use in ComfyUI (might bring to Automatic1111 as well) + # lets do it when its larger than 0 + # Otherwise, just do nothing and it will keep on working based on an earlier set seed + if(seed > 0): + random.seed(seed) + + if(reverse_polarity): + flufferlist = csv_to_list("antifluff") # all negative words + else: + flufferlist = csv_to_list("fluff") + + # dynamic = based on prompt length + insanitylevel + minfluff = 4 + maxfluff = 6 + # short = 4-6 + # medium = 5-8 + # long = 8-12 + if(amountoffluff == "dynamic"): + + if(len(prompt) < 150): + amountoffluff = "long" + elif(len(prompt) < 250): + amountoffluff = "medium" + else: + amountoffluff = "short" + + if(amountoffluff == "long"): + minfluff = 8 + maxfluff = 12 + if(amountoffluff == "medium"): + minfluff = 5 + maxfluff = 8 + + for i in range(0,random.randint(minfluff, maxfluff)): + prompt += ", " + flufferlist.pop(flufferlist.index(random.choice(flufferlist))) + + return prompt + + + + def replace_match(match): # Extract the first word from the match words = match.group(0)[1:-1].split('|') diff --git a/csvfiles/antifluff.csv b/csvfiles/antifluff.csv new file mode 100644 index 0000000..a872887 --- /dev/null +++ b/csvfiles/antifluff.csv @@ -0,0 +1,99 @@ +Amateurish +Amateurish composition +Amateurish creative +Arid +Background uninspired +bad atmosphere +bad quality +Barren +Basic +Basic detail +Basic dull focus +Basic ordinary dim light +Basic straightforward color +Basic straightforward color composition +Blurry focus +Clashing colors +Cloudy +Clumsy +Coarse artistic composition +Coarse detail +Common +Contaminated +Copied +Dim +Dim illumination +Dim light +Diminished quality +Disenchanted +Disgrace +Dull +Dull colors +Dull light +Faded colors +Illogical background +Imperfect background +Imperfect composition +Imperfect symmetry +Incoherent +Insecure +Insignificant +Lacking detail +Losing +Low color focused +Low contrasted +Low enhanced +Low intricate +low quality +Matte +Mediocre aesthetic +Mediocre color +Mediocre composition +Mild +Monochrome +ms paint +Mundane +Mundane atmosphere +Mundane composition +Negative emotional +Not very +Ordinary +Ordinary basic rough coarse detail +Ordinary detail +Ordinary simple low quality color basic +Pale colors +Plain +Plain clumsy +Profane +Realistic +Rough +Rough polished +Rugged +Simple +Sketchy +Stagnant +Static +Static background +Static boring incomplete lackluster +Static color +Static composition +Static dull atmosphere +Static imperfect background +Static plain composition +Surface +Ugly +Unappealing composition +Unattractive +Unchanged +Unimaginative +Unimpressive +Uninspirational +Uninspired +Unknown +Unknown quality +Unoriginal +Unromantic +Unstylish +Untheatrical +Void +Worst \ No newline at end of file diff --git a/csvfiles/fluff.csv b/csvfiles/fluff.csv new file mode 100644 index 0000000..29cc3ae --- /dev/null +++ b/csvfiles/fluff.csv @@ -0,0 +1,130 @@ +advanced cinematic perfect light +aesthetic +ambient +ambient atmosphere +ambient background +ambient illumination +ambient light +artistic +atmosphere +background inspired +badge +beautiful +beautiful composition +beautiful detailed +beautiful detailed supreme quality color intricate +beautiful elegant +best +cinematic +cinematic atmosphere +cinematic light +cinematic perfect intricate stunning fine detail +colorful +complex +complex artistic color composition +complimentary colors +confident +contemporary +contemporary fine detail +cool colors +creative +cute +deep aesthetic +deep rich colors +delicate +detailed +dramatic +dynamic +dynamic background +dynamic cinematic color +dynamic cinematic perfect background +dynamic composition +dynamic dramatic atmosphere +dynamic dramatic beautiful full taking +dynamic dramatic composition +elaborate +elegant +enchanted +enhanced quality +epic +epic atmosphere +epic composition +excellent composition +exquisite color +extremely rich detail +extremely stylish +fabulous colors +fantastic aesthetic +fertile +fine artistic composition +fine detail +fine polished +flowing +full color +glossy +glowing +gorgeous +grand illumination +great composition +great light +handsome +highly color focused +highly complex +highly contrasted +highly decorated +highly detail +highly detailed +highly enhanced +highly intricate +holy +illustrious +illustrious quality +imposing +inspired +intense +intricate +intricate artistic color +intricate detail +located artistic +lush +luxurious +luxurious sharp focus +luxury +magic atmosphere +magical +magical atmosphere +magical composition +magnificent +modified +original +perfect background +perfect composition +perfect symmetry +polished +positive emotional +professional creative +professional fine composition +pure +quality +radiant +rich deep colors +rich vivid colors +romantic +set logical ambient background +sharp focus +shiny +striking +stunning +stunning detail +sublime +sunny +surreal +theatrical +unique +very +very coherent +very inspirational +vibrant +vivid colors +warm light +winning \ No newline at end of file diff --git a/prompttester.py b/prompttester.py index 5a360dd..8e0d2e3 100644 --- a/prompttester.py +++ b/prompttester.py @@ -94,10 +94,10 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im print("") print("All done!") -generateprompts(10,4 +generateprompts(10,5 ,"all" # subject ,"all" # artists - ,"dynamic templates mode" # image type "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" + ,"artify mode" # image type "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", "dynamic templates mode", "artify mode" , False # only artists ,"","","PREFIXPROMPT" ,"SUFFIXPROMPT"