Finished samesubject logic
This commit is contained in:
+54
-12
@@ -1957,6 +1957,29 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all
|
||||
# In front and the back?
|
||||
completeprompt = parse_custom_functions(completeprompt, insanitylevel)
|
||||
|
||||
# Sometimes change he/she to the actual subject
|
||||
if(normal_dist(insanitylevel)
|
||||
and "-human-" in completeprompt or
|
||||
"-humanoid-" in completeprompt or
|
||||
"-manwoman-" in completeprompt or
|
||||
"-job-" in completeprompt or
|
||||
"-fictional-" in completeprompt or
|
||||
"-nonfictional-" in completeprompt or
|
||||
"-firstname-" in completeprompt or
|
||||
"-malefemale-" in completeprompt):
|
||||
completeprompt = completeprompt.replace("-heshe-", "-samehumansubject-",1)
|
||||
|
||||
# Sometimes change he/she to the actual subject
|
||||
if(normal_dist(insanitylevel)
|
||||
and "-animal-" in completeprompt or
|
||||
"-object-" in completeprompt or
|
||||
"-vehicle-" in completeprompt or
|
||||
"-food-" in completeprompt or
|
||||
"-objecttotal-" in completeprompt or
|
||||
"-space-" in completeprompt or
|
||||
"-flora-" in completeprompt):
|
||||
completeprompt = completeprompt.replace("-heshe-", "-sameothersubject-",1)
|
||||
|
||||
# hair descriptor
|
||||
if(rare_dist(insanitylevel)): # Use base outfit descriptor, until we are not.
|
||||
completeprompt = completeprompt.replace("-hairdescriptor-", "-descriptor-",1)
|
||||
@@ -2680,23 +2703,38 @@ def replacewildcard(completeprompt, insanitylevel, wildcard,listname, activatehy
|
||||
if(wildcard == "-outfit-" or wildcard == "-minioutfit-"):
|
||||
completeprompt = completeprompt.replace("-sameoutfit-", replacementvalue,1)
|
||||
|
||||
if(wildcard in ["-animal-"
|
||||
,"-human-"
|
||||
if(wildcard in ["-human-"
|
||||
,"-humanoid-"
|
||||
, "-manwoman-"
|
||||
, "-malefemale-"
|
||||
, "-object-"
|
||||
, "-fictional-"
|
||||
, "-manwoman-"
|
||||
, "-job-"]
|
||||
and "-samehumansubject-" in completeprompt):
|
||||
if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")):
|
||||
completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalue)
|
||||
|
||||
if(wildcard in ["-fictional-"
|
||||
, "-nonfictional-"
|
||||
, "-building-"
|
||||
, "-firstname-"]
|
||||
and "-samehumansubject-" in completeprompt):
|
||||
if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")):
|
||||
completeprompt = completeprompt.replace("-samehumansubject-", replacementvalue)
|
||||
|
||||
# This one last, since then it is the only subject we have left
|
||||
if(wildcard in ["-malefemale-"]
|
||||
and "-samehumansubject-" in completeprompt):
|
||||
if(completeprompt.index(wildcard) < completeprompt.index("-samehumansubject-")):
|
||||
completeprompt = completeprompt.replace("-samehumansubject-", "the " + replacementvalue,1)
|
||||
|
||||
if(wildcard in ["-animal-"
|
||||
, "-object-"
|
||||
, "-vehicle-"
|
||||
, "-food-"
|
||||
, "-job-"
|
||||
, "-objecttotal-"
|
||||
, "-objecttotal-"
|
||||
, "-space-"
|
||||
, "-firstname-"]
|
||||
and chance_roll(insanitylevel, "uncommon")):
|
||||
completeprompt = completeprompt.replace("-heshe-", "the " + replacementvalue,1)
|
||||
, "-flora-"]
|
||||
and "-sameothersubject-" in completeprompt):
|
||||
if(completeprompt.index(wildcard) < completeprompt.index("-sameothersubject-")):
|
||||
completeprompt = completeprompt.replace("-sameothersubject-", "the " + replacementvalue,1)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2835,6 +2873,10 @@ def parse_custom_functions(completeprompt, insanitylevel = 5):
|
||||
arguments = [arg.strip() for arg in match.split(';')]
|
||||
|
||||
# Evaluate the 'or()' function and append the result to the results list
|
||||
|
||||
# For debugging, enable these lines
|
||||
#print(completeprompt)
|
||||
#print(arguments)
|
||||
or_replacement = custom_or(arguments, insanitylevel)
|
||||
completematch = 'OR(' + match + ')'
|
||||
completeprompt = completeprompt.replace(completematch, or_replacement)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
OR(;-heshe- has;uncommon) OR(-haircolor-;-hairdescriptor-;-culture-;uncommon) hair OR(styled as -hairstyle-;,;rare)
|
||||
OR(;-heshe- has;uncommon) OR(-haircolor-;-hairdescriptor-;-culture-;uncommon) hair OR(styled as -hairstyle-;, ;rare)
|
||||
OR(;-heshe- has;uncommon) OR(-haircolor-; -hairstyle-) OR(hairstyle;hair)
|
||||
, -hisher- hair is OR(-haircolor-;-hairdescriptor-;-culture-;uncommon) OR(;and styled as -hairstyle-;rare)
|
||||
|
@@ -11,6 +11,6 @@ OR(;, -heshe- is;rare) -miniactivity- OR(in;at) a OR(-location-;-building-;-wate
|
||||
OR(;, -heshe- is;rare) wearing -elaborateoutfit-
|
||||
- OR(-animal-;-humanoid-) OR(;hybrid;normal)
|
||||
OR(;, -heshe-;rare) as -culture- -rpgclass-
|
||||
OR(;, -heshe- is;rare) sitting in a OR(-descriptor-;uncommon) -chair-
|
||||
OR(;, -heshe- is;rare) sitting in a OR(;-descriptor-;uncommon) -chair-
|
||||
OR(;, -heshe- is;rare) inside a -container-
|
||||
OR(;, -heshe- is;rare) OR(surrounded by;being looked at by) a OR(couple;group) of OR(;-descriptor-;uncommon) OR(people;-malefemale-s;animals) OR(;wearing OR(;-descriptor-;uncommon) -outfit-;rare)
|
||||
|
+1
-1
@@ -51,7 +51,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im
|
||||
print("")
|
||||
print("All done!")
|
||||
|
||||
generateprompts(10,10
|
||||
generateprompts(100,10
|
||||
,"" # subject
|
||||
,"all","all",False,"","","PREFIXPROMPT"
|
||||
,"SUFFIXPROMPT -heshe- is looking here"
|
||||
|
||||
Reference in New Issue
Block a user