added subtype options + interface changes
This commit is contained in:
+178
-14
@@ -15,7 +15,12 @@ from main import *
|
||||
from model_lists import *
|
||||
from csv_reader import *
|
||||
|
||||
subjects = ["all","object","animal","humanoid", "landscape", "concept"]
|
||||
|
||||
#subjects = ["all","object","animal","humanoid", "landscape", "concept"]
|
||||
subjects =["all"]
|
||||
subjectsubtypesobject = ["all"]
|
||||
subjectsubtypeshumanoid = ["all"]
|
||||
subjectsubtypesconcept = ["all"]
|
||||
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"]
|
||||
promptmode = ["at the back", "in the front"]
|
||||
@@ -67,8 +72,124 @@ for filename in os.listdir(userfilesfolder):
|
||||
artists.insert(2, name)
|
||||
|
||||
# on startup, check if we have a config file, or else create it
|
||||
load_config_csv()
|
||||
|
||||
config = load_config_csv()
|
||||
|
||||
# load subjects stuff from config
|
||||
generatevehicle = True
|
||||
generateobject = True
|
||||
generatefood = True
|
||||
generatebuilding = True
|
||||
generatespace = True
|
||||
generateanimal = True
|
||||
generatemanwoman = True
|
||||
generatemanwomanrelation = True
|
||||
generatefictionalcharacter = True
|
||||
generatenonfictionalcharacter = True
|
||||
generatehumanoids = True
|
||||
generatejob = 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
|
||||
# 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
|
||||
# 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")
|
||||
|
||||
# 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")
|
||||
|
||||
# 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 Script(scripts.Script):
|
||||
|
||||
@@ -80,12 +201,12 @@ class Script(scripts.Script):
|
||||
|
||||
|
||||
def ui(self, is_img2img):
|
||||
def gen_prompt(insanitylevel, subject, artist, imagetype, antistring, prefixprompt, suffixprompt, promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage, imagemodechance,chosengender):
|
||||
def gen_prompt(insanitylevel, subject, artist, imagetype, antistring, prefixprompt, suffixprompt, promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept):
|
||||
|
||||
promptlist = []
|
||||
|
||||
for i in range(5):
|
||||
promptlist.append(build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring,prefixprompt,suffixprompt,promptcompounderlevel,seperator,givensubject,smartsubject, giventypeofimage, imagemodechance,chosengender))
|
||||
promptlist.append(build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring,prefixprompt,suffixprompt,promptcompounderlevel,seperator,givensubject,smartsubject, giventypeofimage, imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept))
|
||||
|
||||
return promptlist
|
||||
|
||||
@@ -128,6 +249,12 @@ class Script(scripts.Script):
|
||||
artist = gr.Dropdown(
|
||||
artists, label="Artists", value="all")
|
||||
with gr.Row():
|
||||
chosensubjectsubtypeobject = gr.Dropdown(
|
||||
subjectsubtypesobject, label="Type of object", value="all", visible=False)
|
||||
chosensubjectsubtypehumanoid = gr.Dropdown(
|
||||
subjectsubtypeshumanoid, label="Type of humanoids", value="all", visible=False)
|
||||
chosensubjectsubtypeconcept = gr.Dropdown(
|
||||
subjectsubtypesconcept, label="Type of concept", value="all", visible=False)
|
||||
chosengender = gr.Dropdown(
|
||||
genders, label="gender", value="all", visible=False)
|
||||
with gr.Row():
|
||||
@@ -147,8 +274,6 @@ class Script(scripts.Script):
|
||||
with gr.Row():
|
||||
givensubject = gr.Textbox(label="Overwrite subject: ", value="")
|
||||
smartsubject = gr.Checkbox(label="Smart subject", value = True)
|
||||
with gr.Row():
|
||||
giventypeofimage = gr.Textbox(label="Overwrite type of image: ", value="")
|
||||
with gr.Row():
|
||||
gr.Markdown("""
|
||||
<font size="2">
|
||||
@@ -168,6 +293,8 @@ class Script(scripts.Script):
|
||||
</font>
|
||||
"""
|
||||
)
|
||||
with gr.Row():
|
||||
giventypeofimage = gr.Textbox(label="Overwrite type of image: ", value="")
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
antistring = gr.Textbox(label="Filter out following properties (comma seperated). Example ""film grain, purple, cat"" ")
|
||||
@@ -415,11 +542,11 @@ class Script(scripts.Script):
|
||||
"""
|
||||
### TXT2IMG
|
||||
<font size="2">
|
||||
Start WebUi with option --api for this to work. This is not needed for Vlad.
|
||||
Start WebUi with option --api for this to work. This is not needed for Vlad SD Next.
|
||||
|
||||
Note: This part is entirely optional and you can use the normal generate button.
|
||||
|
||||
This part is intended for running an upscaling at the same time.
|
||||
This part is only intended for running an upscaling at the same time.
|
||||
</font>
|
||||
"""
|
||||
)
|
||||
@@ -563,7 +690,7 @@ class Script(scripts.Script):
|
||||
extrasupscaler2codeformerweight = gr.Slider(0, 1, value="0.1", step=0.05, label="CodeFormer weight", visible = False)
|
||||
|
||||
|
||||
genprom.click(gen_prompt, inputs=[insanitylevel,subject, artist, imagetype, antistring,prefixprompt, suffixprompt,promptcompounderlevel, seperator, givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender], outputs=[prompt1, prompt2, prompt3,prompt4,prompt5])
|
||||
genprom.click(gen_prompt, inputs=[insanitylevel,subject, artist, imagetype, antistring,prefixprompt, suffixprompt,promptcompounderlevel, seperator, givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept], outputs=[prompt1, prompt2, prompt3,prompt4,prompt5])
|
||||
|
||||
prompt1toworkflow.click(prompttoworkflowprompt, inputs=prompt1, outputs=workprompt)
|
||||
prompt2toworkflow.click(prompttoworkflowprompt, inputs=prompt2, outputs=workprompt)
|
||||
@@ -571,7 +698,7 @@ class Script(scripts.Script):
|
||||
prompt4toworkflow.click(prompttoworkflowprompt, inputs=prompt4, outputs=workprompt)
|
||||
prompt5toworkflow.click(prompttoworkflowprompt, inputs=prompt5, outputs=workprompt)
|
||||
|
||||
startmain.click(generateimages, inputs=[amountofimages,size,model,samplingsteps,cfg,hiresfix,hiressteps,denoisestrength,samplingmethod, upscaler,hiresscale, apiurl, qualitygate, quality, runs,insanitylevel,subject, artist, imagetype, silentmode, workprompt, antistring, prefixprompt, suffixprompt,negativeprompt,promptcompounderlevel, seperator, img2imgbatch, img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel,img2imgactivate, img2imgscale, img2imgpadding,img2imgdenoisestrength,ultimatesdupscale,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur, controlnetenabled, controlnetmodel,img2imgdenoisestrengthmod,enableextraupscale,controlnetblockymode,extrasupscaler1,extrasupscaler2,extrasupscaler2visiblity,extrasupscaler2gfpgan,extrasupscaler2codeformer,extrasupscaler2codeformerweight,extrasresize,onlyupscale,givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender])
|
||||
startmain.click(generateimages, inputs=[amountofimages,size,model,samplingsteps,cfg,hiresfix,hiressteps,denoisestrength,samplingmethod, upscaler,hiresscale, apiurl, qualitygate, quality, runs,insanitylevel,subject, artist, imagetype, silentmode, workprompt, antistring, prefixprompt, suffixprompt,negativeprompt,promptcompounderlevel, seperator, img2imgbatch, img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel,img2imgactivate, img2imgscale, img2imgpadding,img2imgdenoisestrength,ultimatesdupscale,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur, controlnetenabled, controlnetmodel,img2imgdenoisestrengthmod,enableextraupscale,controlnetblockymode,extrasupscaler1,extrasupscaler2,extrasupscaler2visiblity,extrasupscaler2gfpgan,extrasupscaler2codeformer,extrasupscaler2codeformerweight,extrasresize,onlyupscale,givensubject,smartsubject,giventypeofimage,imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept])
|
||||
|
||||
automatedoutputsfolderbutton.click(openfolder)
|
||||
|
||||
@@ -586,7 +713,44 @@ class Script(scripts.Script):
|
||||
[subject],
|
||||
[chosengender]
|
||||
)
|
||||
|
||||
# turn things on and off for subject subtype object
|
||||
def subjectsvalueforsubtypeobject(subject):
|
||||
enable=(subject=="object")
|
||||
return {
|
||||
chosensubjectsubtypeobject: gr.update(visible=enable),
|
||||
}
|
||||
subject.change(
|
||||
subjectsvalueforsubtypeobject,
|
||||
[subject],
|
||||
[chosensubjectsubtypeobject]
|
||||
)
|
||||
|
||||
# turn things on and off for subject subtype humanoid
|
||||
def subjectsvalueforsubtypeobject(subject):
|
||||
enable=(subject=="humanoid")
|
||||
return {
|
||||
chosensubjectsubtypehumanoid: gr.update(visible=enable),
|
||||
}
|
||||
subject.change(
|
||||
subjectsvalueforsubtypeobject,
|
||||
[subject],
|
||||
[chosensubjectsubtypehumanoid]
|
||||
)
|
||||
|
||||
# turn things on and off for subject subtype concept
|
||||
def subjectsvalueforsubtypeconcept(subject):
|
||||
enable=(subject=="concept")
|
||||
return {
|
||||
chosensubjectsubtypeconcept: gr.update(visible=enable),
|
||||
}
|
||||
subject.change(
|
||||
subjectsvalueforsubtypeconcept,
|
||||
[subject],
|
||||
[chosensubjectsubtypeconcept]
|
||||
)
|
||||
|
||||
|
||||
# Turn things off and on for onlyupscale and txt2img
|
||||
def onlyupscalevalues(onlyupscale):
|
||||
onlyupscale = not onlyupscale
|
||||
@@ -689,12 +853,12 @@ class Script(scripts.Script):
|
||||
|
||||
|
||||
|
||||
return [insanitylevel,subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring, seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender]
|
||||
return [insanitylevel,subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring, seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept]
|
||||
|
||||
|
||||
|
||||
|
||||
def run(self, p, insanitylevel, subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring,seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender):
|
||||
def run(self, p, insanitylevel, subject, artist, imagetype, prefixprompt,suffixprompt,negativeprompt, promptcompounderlevel, ANDtoggle, silentmode, workprompt, antistring,seperator, givensubject, smartsubject, giventypeofimage, imagemodechance, chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept):
|
||||
|
||||
images = []
|
||||
infotexts = []
|
||||
@@ -766,7 +930,7 @@ class Script(scripts.Script):
|
||||
|
||||
|
||||
#Here is where we build a "normal" prompt
|
||||
preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring, prefixprompt, suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance,chosengender)
|
||||
preppedprompt += build_dynamic_prompt(insanitylevel,subject,artist, imagetype, False, antistring, prefixprompt, suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance,chosengender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept)
|
||||
|
||||
# set the artist mode back when done (for automatic mode)
|
||||
artist = artistcopy
|
||||
|
||||
Reference in New Issue
Block a user