diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 14290ac..e3bae58 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -88,7 +88,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all hairvomitlist = csv_to_list("hairvomit",antilist,"./csvfiles/",0,"?",False,False) humanactivitylist = csv_to_list("human_activities",antilist) humanoidlist = csv_to_list("humanoids",antilist) - imagetypelist = csv_to_list("imagetypes",antilist) + imagetypelist = csv_to_list(csvfilename="imagetypes",antilist=antilist, insanitylevel=insanitylevel) + print(imagetypelist) joblist = csv_to_list(csvfilename="jobs",antilist=antilist,skipheader=True,gender=gender) lenslist = csv_to_list("lenses",antilist) lightinglist = csv_to_list("lighting",antilist) diff --git a/csv_reader.py b/csv_reader.py index 1fd7d70..8f36558 100644 --- a/csv_reader.py +++ b/csv_reader.py @@ -19,14 +19,18 @@ def add_from_csv(completeprompt, csvfilename, addcomma, prefix, suffix): return ", ".join([completeprompt,addtoprompt]) return " ".join([completeprompt,addtoprompt]) -def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip=0, delimiter=";", listoflistmode = False, skipheader = False, gender = "all"): +def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip=0, delimiter=";", listoflistmode = False, skipheader = False, gender = "all", insanitylevel = -1): + replacing = False userfilesdirectory = "./userfiles/" userfileaddonname = csvfilename + "_addon.csv" userfilereplacename = csvfilename + "_replace.csv" + lightfilename = csvfilename + "_light.csv" + mediumfilename = csvfilename + "_medium.csv" csvlist = [] script_dir = os.path.dirname(os.path.abspath(__file__)) full_path = os.path.join(script_dir, directory ) userfilesfolder = os.path.join(script_dir, userfilesdirectory ) + directoryfilesfolder = os.path.join(script_dir, directory ) # check if there is a replace file if(directory=="./csvfiles/" or directory=="./csvfiles/special_lists/" or directory=="./csvfiles/templates/"): for filename in os.listdir(userfilesfolder): @@ -34,6 +38,26 @@ def csv_to_list(csvfilename, antilist=[], directory="./csvfiles/", lowerandstrip # Just override the parameters, and let it run normally full_path = os.path.join(script_dir, userfilesdirectory ) csvfilename = csvfilename + "_replace" + replacing = True + + + # Go check for light or medium files if there is no override and there is an insanitylevel + if(replacing == False and insanitylevel > 0): + if(insanitylevel < 4): + for filename in os.listdir(directoryfilesfolder): + if(filename == mediumfilename): + # Just override the parameters, and let it run normally + full_path = os.path.join(script_dir, directory ) + csvfilename = csvfilename + "_light" + replacing = True + if(insanitylevel < 7 and random.randint(0,5) < 4 and replacing == False): + for filename in os.listdir(directoryfilesfolder): + if(filename == lightfilename): + # Just override the parameters, and let it run normally + full_path = os.path.join(script_dir, directory ) + csvfilename = csvfilename + "_medium" + replacing = True + # return empty list if we can't find the file. Build for antilist.csv diff --git a/csvfiles/imagetypes_light.csv b/csvfiles/imagetypes_light.csv new file mode 100644 index 0000000..7538ab1 --- /dev/null +++ b/csvfiles/imagetypes_light.csv @@ -0,0 +1,8 @@ +RAW photo +Photograph +Digital art +3D Rendering +Concept art +Portrait +Anime +Cinematic still \ No newline at end of file diff --git a/csvfiles/imagetypes_medium.csv b/csvfiles/imagetypes_medium.csv new file mode 100644 index 0000000..c4984f8 --- /dev/null +++ b/csvfiles/imagetypes_medium.csv @@ -0,0 +1,17 @@ +RAW photo +Photograph +Cosplay Photograph +Color splash +Digital art +3D Rendering +Painting +Drawing +Vector Art +Water color painting +Oil painting +Concept art +Portrait +Raw digital photo +On pale black paper +Anime +Cinematic still \ No newline at end of file diff --git a/prompttester.py b/prompttester.py index 68791e6..5e30aa7 100644 --- a/prompttester.py +++ b/prompttester.py @@ -71,7 +71,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im print("") print("All done!") -generateprompts(10,5 +generateprompts(10,3 ,"all" # subject ,"all" # artists ,"all" # 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"