first fix for out of mem issues
parent
4d817fbff6
commit
0a89c8673a
|
|
@ -100,7 +100,7 @@ def call_img2img(imagelocation,originalimage, originalpnginfo ="", apiurl="http:
|
||||||
|
|
||||||
if(upscaler== "4x-UltraSharp"):
|
if(upscaler== "4x-UltraSharp"):
|
||||||
denoising_strength = "0.35"
|
denoising_strength = "0.35"
|
||||||
if(upscaler== "R-ESRGAN 4x+ Anime6B+"):
|
if(upscaler== "R-ESRGAN 4x+ Anime6B"):
|
||||||
denoising_strength = "0.6" # 0.6 is fine for the anime upscaler
|
denoising_strength = "0.6" # 0.6 is fine for the anime upscaler
|
||||||
if(upscaler== "R-ESRGAN 4x+"):
|
if(upscaler== "R-ESRGAN 4x+"):
|
||||||
denoising_strength = "0.5" # default 0.6 is a lot and changes a lot of details
|
denoising_strength = "0.5" # default 0.6 is a lot and changes a lot of details
|
||||||
|
|
@ -156,14 +156,14 @@ def call_img2img(imagelocation,originalimage, originalpnginfo ="", apiurl="http:
|
||||||
})
|
})
|
||||||
if(upscalescript=="SD upscale"):
|
if(upscalescript=="SD upscale"):
|
||||||
payload.update({"script_name": upscalescript})
|
payload.update({"script_name": upscalescript})
|
||||||
payload.update({"script_args": ["",int(padding),upscaler,float(scale)]})
|
payload.update({"script_args": ["",int(padding),upscaler,round(float(scale),1)]})
|
||||||
|
|
||||||
if(upscalescript=="Ultimate SD upscale"):
|
if(upscalescript=="Ultimate SD upscale"):
|
||||||
upscaler_index = [x.name.lower() for x in shared.sd_upscalers].index(upscaler.lower())
|
upscaler_index = [x.name.lower() for x in shared.sd_upscalers].index(upscaler.lower())
|
||||||
payload.update({"script_name": upscalescript})
|
payload.update({"script_name": upscalescript})
|
||||||
payload.update({"script_args": ["",int(usdutilewidth),int(usdutileheight),int(usdumaskblur),int(padding), int(usduswidth), float(usdusdenoise),int(usduspadding),
|
payload.update({"script_args": ["",int(usdutilewidth),int(usdutileheight),int(usdumaskblur),int(padding), int(usduswidth), round(float(usdusdenoise),2),int(usduspadding),
|
||||||
upscaler_index,True,usduredrawint,False,int(usdusmaskblur),
|
upscaler_index,True,usduredrawint,False,int(usdusmaskblur),
|
||||||
seamsfixmodeint,2,"","",float(scale)]})
|
seamsfixmodeint,2,"","",round(float(scale),1)]})
|
||||||
|
|
||||||
# Ultimate SD Upscale params:
|
# Ultimate SD Upscale params:
|
||||||
#_, tile_width, tile_height, mask_blur, padding, seams_fix_width, seams_fix_denoise, seams_fix_padding,
|
#_, tile_width, tile_height, mask_blur, padding, seams_fix_width, seams_fix_denoise, seams_fix_padding,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ Abstract Illusionism
|
||||||
Academism
|
Academism
|
||||||
Action Painting
|
Action Painting
|
||||||
Aestheticism
|
Aestheticism
|
||||||
|
Aetherpunk
|
||||||
Afrofuturism
|
Afrofuturism
|
||||||
Afropunk
|
Afropunk
|
||||||
Altermodern
|
Altermodern
|
||||||
|
|
@ -31,6 +32,7 @@ Ascii Art
|
||||||
Ashcan School
|
Ashcan School
|
||||||
Atomicpunk
|
Atomicpunk
|
||||||
Atompunk
|
Atompunk
|
||||||
|
Astropunk
|
||||||
Auroracore
|
Auroracore
|
||||||
Australian Tonalism
|
Australian Tonalism
|
||||||
Auto-Destructive Art
|
Auto-Destructive Art
|
||||||
|
|
@ -85,16 +87,19 @@ Cyberpop
|
||||||
Cyberpunk Art
|
Cyberpunk Art
|
||||||
Dada Art
|
Dada Art
|
||||||
Dark Wave Art
|
Dark Wave Art
|
||||||
|
Darksynth
|
||||||
Darkcore
|
Darkcore
|
||||||
Darkpunk
|
Darkpunk
|
||||||
De Stijl
|
De Stijl
|
||||||
Deathpunk
|
Deathpunk
|
||||||
Decopunk
|
Decopunk
|
||||||
Decora
|
Decora
|
||||||
|
decal art
|
||||||
Demoscene
|
Demoscene
|
||||||
Destructive Art
|
Destructive Art
|
||||||
Dieselpunk
|
Dieselpunk
|
||||||
Digital Art
|
Digital Art
|
||||||
|
divisionism
|
||||||
dmt
|
dmt
|
||||||
Dollpunk
|
Dollpunk
|
||||||
Doodle Art style
|
Doodle Art style
|
||||||
|
|
@ -115,6 +120,7 @@ Fashwave
|
||||||
Fauvism
|
Fauvism
|
||||||
Feralcore
|
Feralcore
|
||||||
Figurative Art
|
Figurative Art
|
||||||
|
Flat Art
|
||||||
Fluxus Art
|
Fluxus Art
|
||||||
Folk Art
|
Folk Art
|
||||||
Funk Art
|
Funk Art
|
||||||
|
|
@ -125,6 +131,7 @@ Gamercore
|
||||||
Gamerpunk
|
Gamerpunk
|
||||||
Generative Art
|
Generative Art
|
||||||
Geometric Abstract Art
|
Geometric Abstract Art
|
||||||
|
Geometric Style
|
||||||
Glitch Art
|
Glitch Art
|
||||||
Glitchcore
|
Glitchcore
|
||||||
Gloomcore
|
Gloomcore
|
||||||
|
|
@ -133,8 +140,10 @@ Glow In The Dark
|
||||||
Glowwave
|
Glowwave
|
||||||
Goblincore
|
Goblincore
|
||||||
Goth Art
|
Goth Art
|
||||||
|
Gouache Art
|
||||||
Graffiti Street Art
|
Graffiti Street Art
|
||||||
Grindhouse
|
Grindhouse
|
||||||
|
Grimdark
|
||||||
Grunge Art
|
Grunge Art
|
||||||
Grungepunk
|
Grungepunk
|
||||||
Gutai Group
|
Gutai Group
|
||||||
|
|
@ -155,12 +164,16 @@ Icepunk
|
||||||
Impressionism
|
Impressionism
|
||||||
Industrial Art
|
Industrial Art
|
||||||
Islandpunk
|
Islandpunk
|
||||||
|
Impasto
|
||||||
Junglecore
|
Junglecore
|
||||||
Kawaii anime
|
Kawaii anime
|
||||||
|
kalighat
|
||||||
Kinetic Pointillism
|
Kinetic Pointillism
|
||||||
|
kinetic art
|
||||||
Kingcore
|
Kingcore
|
||||||
Knightcore
|
Knightcore
|
||||||
Land Art
|
Land Art
|
||||||
|
Letterism
|
||||||
Libertywave
|
Libertywave
|
||||||
Lightcore
|
Lightcore
|
||||||
Lowbrow Art
|
Lowbrow Art
|
||||||
|
|
@ -170,6 +183,7 @@ Magewave
|
||||||
Magical Realism
|
Magical Realism
|
||||||
Mannerism Art
|
Mannerism Art
|
||||||
Margins Art
|
Margins Art
|
||||||
|
Medieval art
|
||||||
Memecore Art
|
Memecore Art
|
||||||
Metalcore
|
Metalcore
|
||||||
Methaphysical painting
|
Methaphysical painting
|
||||||
|
|
@ -181,6 +195,8 @@ Minimalism Art
|
||||||
Modern Art
|
Modern Art
|
||||||
Modern European Ink Painting
|
Modern European Ink Painting
|
||||||
Modernism Art
|
Modernism Art
|
||||||
|
monotype
|
||||||
|
mosaic
|
||||||
Mushroomcore
|
Mushroomcore
|
||||||
Mythpunk
|
Mythpunk
|
||||||
Naive Art
|
Naive Art
|
||||||
|
|
@ -203,8 +219,10 @@ Nu Goth Art
|
||||||
Orientalism Art
|
Orientalism Art
|
||||||
Orphism
|
Orphism
|
||||||
Panfuturism
|
Panfuturism
|
||||||
|
Patachitra
|
||||||
Pastel Goth Art
|
Pastel Goth Art
|
||||||
Photorealism
|
Photorealism
|
||||||
|
Pin-up
|
||||||
Pixel Art
|
Pixel Art
|
||||||
Pixiecore
|
Pixiecore
|
||||||
Pointillism
|
Pointillism
|
||||||
|
|
@ -260,6 +278,8 @@ Synthpunk
|
||||||
Synthwave Art
|
Synthwave Art
|
||||||
Tattoo style
|
Tattoo style
|
||||||
Terrorwave
|
Terrorwave
|
||||||
|
Technopunk
|
||||||
|
Tenebrism
|
||||||
Teslapunk
|
Teslapunk
|
||||||
Thriftcore
|
Thriftcore
|
||||||
Tinkercore
|
Tinkercore
|
||||||
|
|
@ -280,6 +300,7 @@ Voidpunk
|
||||||
Vorticism Art
|
Vorticism Art
|
||||||
Voxel Art
|
Voxel Art
|
||||||
Warmcore
|
Warmcore
|
||||||
|
Westernpunk
|
||||||
Weirdcore
|
Weirdcore
|
||||||
Witchcore
|
Witchcore
|
||||||
Wizardcore
|
Wizardcore
|
||||||
|
|
|
||||||
|
|
|
@ -7,10 +7,6 @@ Digital art
|
||||||
Painting
|
Painting
|
||||||
Drawing
|
Drawing
|
||||||
Vector Art
|
Vector Art
|
||||||
Gopro footage
|
|
||||||
CCTV
|
|
||||||
Drone photo
|
|
||||||
Thermal camera
|
|
||||||
Water color painting
|
Water color painting
|
||||||
Oil painting
|
Oil painting
|
||||||
wall Graffiti
|
wall Graffiti
|
||||||
|
|
@ -34,4 +30,5 @@ Fractal
|
||||||
portrait
|
portrait
|
||||||
Raw digital photo
|
Raw digital photo
|
||||||
Airbrush painting
|
Airbrush painting
|
||||||
On pale black paper
|
On pale black paper
|
||||||
|
Anime
|
||||||
|
|
|
@ -117,4 +117,5 @@ Diamond
|
||||||
Garment
|
Garment
|
||||||
Galaxy
|
Galaxy
|
||||||
Stars
|
Stars
|
||||||
-space-
|
-space-
|
||||||
|
Lapidary
|
||||||
|
|
|
@ -110,7 +110,6 @@ acrylic marbling art
|
||||||
acrylic painting
|
acrylic painting
|
||||||
acrylic pour
|
acrylic pour
|
||||||
board game
|
board game
|
||||||
claymation
|
|
||||||
cloisonné
|
cloisonné
|
||||||
Doom engine
|
Doom engine
|
||||||
Quake engine
|
Quake engine
|
||||||
|
|
@ -145,4 +144,117 @@ still life
|
||||||
stop motion
|
stop motion
|
||||||
traditional Haida art
|
traditional Haida art
|
||||||
traditional Sámi art
|
traditional Sámi art
|
||||||
x-ray photography
|
x-ray photography
|
||||||
|
Gopro footage
|
||||||
|
CCTV
|
||||||
|
Drone photo
|
||||||
|
Thermal camera
|
||||||
|
50s illustration style
|
||||||
|
60s illustration style
|
||||||
|
70s illustration style
|
||||||
|
80s illustration style
|
||||||
|
90s illustration style
|
||||||
|
doll
|
||||||
|
action figure
|
||||||
|
action painting art
|
||||||
|
alcohol ink art
|
||||||
|
alcohol ink drawing
|
||||||
|
alebrije art
|
||||||
|
ASCII art
|
||||||
|
assemblage art
|
||||||
|
azulejo texture
|
||||||
|
bas-relief art
|
||||||
|
bestiary
|
||||||
|
black ink art
|
||||||
|
blacklight palette
|
||||||
|
brush pen art
|
||||||
|
caricature art
|
||||||
|
carving technique
|
||||||
|
cast paper art
|
||||||
|
catholic icon
|
||||||
|
ceramic figurine
|
||||||
|
charcoal art
|
||||||
|
chiaroscuro art
|
||||||
|
child's drawing
|
||||||
|
cibulak porcelain technique
|
||||||
|
collagraph technique
|
||||||
|
color sketchnote drawing
|
||||||
|
colored pencil drawing
|
||||||
|
comic book art
|
||||||
|
comics art
|
||||||
|
continuous line art
|
||||||
|
contour drawing
|
||||||
|
contour rivalry drawing
|
||||||
|
cross stitch
|
||||||
|
cross-stitching technique
|
||||||
|
cutout art
|
||||||
|
decoupage technique
|
||||||
|
diagram
|
||||||
|
doodling drawing
|
||||||
|
dotted lines art
|
||||||
|
dribbble style
|
||||||
|
hieroglyphs
|
||||||
|
embossing
|
||||||
|
enamel painting art
|
||||||
|
encaustic texture
|
||||||
|
engraving drawing
|
||||||
|
etching technique
|
||||||
|
fashion illustration
|
||||||
|
felt tip pen drawing
|
||||||
|
fresco art
|
||||||
|
fused glass art
|
||||||
|
gilded drawing
|
||||||
|
gobelin tapestry technique
|
||||||
|
gold leafing technique
|
||||||
|
gond painting
|
||||||
|
graffiti print
|
||||||
|
graphic print
|
||||||
|
graphite
|
||||||
|
hologram
|
||||||
|
ink wash art
|
||||||
|
inktober drawing
|
||||||
|
ivory carving technique
|
||||||
|
iznik tiles pattern
|
||||||
|
-culture- vintage poster print
|
||||||
|
kachina doll
|
||||||
|
kirigami art
|
||||||
|
letterpress print
|
||||||
|
linocut drawing
|
||||||
|
lithography print
|
||||||
|
loose sketching drawing
|
||||||
|
low-poly drawing
|
||||||
|
marquetry
|
||||||
|
millefiori
|
||||||
|
Paint splatter
|
||||||
|
palette knife art
|
||||||
|
paper quilling art
|
||||||
|
papercut art
|
||||||
|
papier-mache art
|
||||||
|
patachitra painting
|
||||||
|
patchwork
|
||||||
|
pebble art
|
||||||
|
pen drawing
|
||||||
|
plasticine
|
||||||
|
pyrography
|
||||||
|
quilted art
|
||||||
|
recycled art
|
||||||
|
relief art
|
||||||
|
risograph print
|
||||||
|
scribble art
|
||||||
|
sgraffito drawing
|
||||||
|
silhouette art
|
||||||
|
silk screen
|
||||||
|
sloppy strokes drawing
|
||||||
|
sock puppet
|
||||||
|
stencil art
|
||||||
|
stuffed toy
|
||||||
|
sumi-e outline
|
||||||
|
swirling line drawing
|
||||||
|
tilt and drip drawing
|
||||||
|
tilt and drip painting art
|
||||||
|
underpainting art
|
||||||
|
wireframe drawing
|
||||||
|
woodblock print
|
||||||
|
woodcut drawing
|
||||||
|
woodcut technique
|
||||||
|
zig-zag lines drawing
|
||||||
|
|
|
@ -54,9 +54,13 @@ full of color
|
||||||
geometric patterns
|
geometric patterns
|
||||||
glimmering transformation
|
glimmering transformation
|
||||||
glittering
|
glittering
|
||||||
|
glitter texture
|
||||||
|
gilded technique
|
||||||
Golden ratio
|
Golden ratio
|
||||||
halation
|
halation
|
||||||
|
halftone texture
|
||||||
hearthstone artwork
|
hearthstone artwork
|
||||||
|
icon style
|
||||||
Instagram
|
Instagram
|
||||||
intricate details
|
intricate details
|
||||||
intricate
|
intricate
|
||||||
|
|
@ -74,6 +78,7 @@ matte
|
||||||
MOBA style
|
MOBA style
|
||||||
moody
|
moody
|
||||||
Movie concept art
|
Movie concept art
|
||||||
|
multidimensional
|
||||||
National Geographic
|
National Geographic
|
||||||
opulent
|
opulent
|
||||||
otherworldly
|
otherworldly
|
||||||
|
|
@ -90,6 +95,8 @@ rich color
|
||||||
rpg concept art
|
rpg concept art
|
||||||
Rule of Thirds
|
Rule of Thirds
|
||||||
sfumato
|
sfumato
|
||||||
|
sgraffito
|
||||||
|
sloppy strokes
|
||||||
silhouette
|
silhouette
|
||||||
Simplified style
|
Simplified style
|
||||||
Spirals
|
Spirals
|
||||||
|
|
@ -101,7 +108,10 @@ Swirling -color-
|
||||||
Swirling -material-
|
Swirling -material-
|
||||||
symbolism
|
symbolism
|
||||||
taiji
|
taiji
|
||||||
|
triadic
|
||||||
under water
|
under water
|
||||||
|
underpainting
|
||||||
vibrant
|
vibrant
|
||||||
vignette
|
vignette
|
||||||
|
vintage
|
||||||
Zentangle
|
Zentangle
|
||||||
|
|
|
@ -27,4 +27,6 @@ Bath
|
||||||
Shower
|
Shower
|
||||||
Sauna
|
Sauna
|
||||||
Spa
|
Spa
|
||||||
Thermal baths
|
Thermal baths
|
||||||
|
Thermae
|
||||||
|
-culture- bath
|
||||||
|
108
main.py
108
main.py
|
|
@ -3,6 +3,7 @@ import random
|
||||||
import uuid
|
import uuid
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import time
|
||||||
sys.path.append(os.path.abspath(".."))
|
sys.path.append(os.path.abspath(".."))
|
||||||
|
|
||||||
from call_txt2img import *
|
from call_txt2img import *
|
||||||
|
|
@ -22,9 +23,25 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
filename=""
|
filename=""
|
||||||
originalsize=size
|
originalsize=size
|
||||||
originalmodel = model
|
originalmodel = model
|
||||||
|
originalsamplingmethod = samplingmethod
|
||||||
|
|
||||||
originalimg2imgmodel = img2imgmodel
|
originalimg2imgmodel = img2imgmodel
|
||||||
|
originalimg2imgsamplingmethod = img2imgsamplingmethod
|
||||||
|
originalimg2imgupscaler = img2imgupscaler
|
||||||
|
|
||||||
|
originalupscaler = upscaler
|
||||||
|
|
||||||
insanitylevel = int(insanitylevel)
|
insanitylevel = int(insanitylevel)
|
||||||
|
|
||||||
|
originalimg2imgdenoisestrength = img2imgdenoisestrength
|
||||||
|
originalimg2imgpadding = img2imgpadding
|
||||||
|
|
||||||
|
optionsresponse = requests.get(url=f'{apiurl}/sdapi/v1/options')
|
||||||
|
optionsresponsejson = optionsresponse.json()
|
||||||
|
|
||||||
|
currentlyselectedmodel = optionsresponsejson["sd_model_checkpoint"]
|
||||||
|
|
||||||
|
|
||||||
if(onlyupscale==True):
|
if(onlyupscale==True):
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__)) # Script directory
|
script_dir = os.path.dirname(os.path.abspath(__file__)) # Script directory
|
||||||
inputupscalemefolder = os.path.join(script_dir, "./automated_outputs/upscale_me/" )
|
inputupscalemefolder = os.path.join(script_dir, "./automated_outputs/upscale_me/" )
|
||||||
|
|
@ -59,6 +76,14 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
|
|
||||||
|
|
||||||
while steps < loops:
|
while steps < loops:
|
||||||
|
# load the base model as a workaround
|
||||||
|
if(steps > 0):
|
||||||
|
print("to prevent a memory issue, we are going to load base 1.5, and then load the chosen model back in")
|
||||||
|
option_payload = {
|
||||||
|
"sd_model_checkpoint": "v1-5-pruned-emaonly.safetensors [6ce0161689]"
|
||||||
|
}
|
||||||
|
response = requests.post(url=f'{apiurl}/sdapi/v1/options', json=option_payload)
|
||||||
|
|
||||||
# build prompt
|
# build prompt
|
||||||
if(silentmode==True and workprompt == ""):
|
if(silentmode==True and workprompt == ""):
|
||||||
print("Trying to use provided workflow prompt, but is empty. Generating a random prompt instead.")
|
print("Trying to use provided workflow prompt, but is empty. Generating a random prompt instead.")
|
||||||
|
|
@ -73,12 +98,17 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
randomprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, False,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept)
|
randomprompt = build_dynamic_prompt(insanitylevel,subject,artist,imagetype, False,antistring,prefixprompt,suffixprompt,promptcompounderlevel, seperator,givensubject,smartsubject,giventypeofimage,imagemodechance, gender, chosensubjectsubtypeobject, chosensubjectsubtypehumanoid, chosensubjectsubtypeconcept)
|
||||||
|
|
||||||
# make the filename, from from a to the first comma
|
# make the filename, from from a to the first comma
|
||||||
start_index = randomprompt.find("of a ") + len("of a ")
|
|
||||||
|
|
||||||
# find the index of the first comma after "of a" or end of the prompt
|
# find the index of the first comma after "of a" or end of the prompt
|
||||||
end_index = randomprompt.find(",", start_index)
|
if(randomprompt.find("of a ") != -1):
|
||||||
if(end_index == -1):
|
start_index = randomprompt.find("of a ") + len("of a ")
|
||||||
end_index=len(randomprompt)
|
end_index = randomprompt.find(",", start_index)
|
||||||
|
if(end_index == -1):
|
||||||
|
end_index=len(randomprompt)
|
||||||
|
else:
|
||||||
|
start_index = 0
|
||||||
|
end_index = 128
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# extract the desired substring using slicing
|
# extract the desired substring using slicing
|
||||||
filename = randomprompt[start_index:end_index]
|
filename = randomprompt[start_index:end_index]
|
||||||
|
|
@ -99,6 +129,7 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
# create a datetime object for the current date and time
|
# create a datetime object for the current date and time
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
filenamecomplete = now.strftime("%Y%m%d%H%M%S") + "_" + filename.replace(" ", "_").strip()
|
filenamecomplete = now.strftime("%Y%m%d%H%M%S") + "_" + filename.replace(" ", "_").strip()
|
||||||
|
originalfilenamecomplete = filenamecomplete
|
||||||
|
|
||||||
# prompt + size
|
# prompt + size
|
||||||
if(originalsize == "all"):
|
if(originalsize == "all"):
|
||||||
|
|
@ -113,20 +144,22 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
while "inpaint" in model:
|
while "inpaint" in model:
|
||||||
model = random.choice(modellist)
|
model = random.choice(modellist)
|
||||||
print("Going to run with model " + model)
|
print("Going to run with model " + model)
|
||||||
|
if(originalmodel=="currently selected model"):
|
||||||
|
model = currentlyselectedmodel
|
||||||
|
|
||||||
|
|
||||||
# set the model here
|
# set the model here
|
||||||
if(originalmodel!="currently selected model"):
|
#if(originalmodel!="currently selected model"):
|
||||||
option_payload = {
|
option_payload = {
|
||||||
"sd_model_checkpoint": model
|
"sd_model_checkpoint": model
|
||||||
}
|
}
|
||||||
response = requests.post(url=f'{apiurl}/sdapi/v1/options', json=option_payload)
|
response = requests.post(url=f'{apiurl}/sdapi/v1/options', json=option_payload)
|
||||||
|
|
||||||
if(samplingmethod=="all"):
|
if(originalsamplingmethod=="all"):
|
||||||
samplingmethod = random.choice(samplerlist)
|
samplingmethod = random.choice(samplerlist)
|
||||||
print ("Going to run with sampling method " + samplingmethod)
|
print ("Going to run with sampling method " + samplingmethod)
|
||||||
|
|
||||||
if(upscaler=="all" and hiresfix == True):
|
if(originalupscaler=="all" and hiresfix == True):
|
||||||
upscaler = random.choice(upscalerlist)
|
upscaler = random.choice(upscalerlist)
|
||||||
print ("Going to run with upscaler " + upscaler)
|
print ("Going to run with upscaler " + upscaler)
|
||||||
|
|
||||||
|
|
@ -158,12 +191,7 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
img2imgloops = int(img2imgbatch)
|
img2imgloops = int(img2imgbatch)
|
||||||
if(img2imgactivate == False): # If we dont want to run, turn it off
|
if(img2imgactivate == False): # If we dont want to run, turn it off
|
||||||
img2imgloops = 0
|
img2imgloops = 0
|
||||||
img2imgsteps = 0
|
else:
|
||||||
|
|
||||||
# start the batching!
|
|
||||||
while img2imgsteps < img2imgloops:
|
|
||||||
|
|
||||||
|
|
||||||
#Check if there is any random value we have to choose or not
|
#Check if there is any random value we have to choose or not
|
||||||
if(originalimg2imgmodel=="all"):
|
if(originalimg2imgmodel=="all"):
|
||||||
img2imgmodel = random.choice(modellist)
|
img2imgmodel = random.choice(modellist)
|
||||||
|
|
@ -171,38 +199,60 @@ def generateimages(amount = 1, size = "all",model = "currently selected model",s
|
||||||
while "inpaint" in model:
|
while "inpaint" in model:
|
||||||
img2imgmodel = random.choice(modellist)
|
img2imgmodel = random.choice(modellist)
|
||||||
print("Going to upscale with model " + img2imgmodel)
|
print("Going to upscale with model " + img2imgmodel)
|
||||||
|
if(originalimg2imgmodel=="currently selected model"):
|
||||||
|
img2imgmodel = currentlyselectedmodel
|
||||||
|
|
||||||
# set the model here
|
# set the model here
|
||||||
if(originalimg2imgmodel!="currently selected model"):
|
#if(originalimg2imgmodel!="currently selected model"):
|
||||||
option_payload = {
|
option_payload = {
|
||||||
"sd_model_checkpoint": img2imgmodel
|
"sd_model_checkpoint": img2imgmodel
|
||||||
}
|
}
|
||||||
response = requests.post(url=f'{apiurl}/sdapi/v1/options', json=option_payload)
|
response = requests.post(url=f'{apiurl}/sdapi/v1/options', json=option_payload)
|
||||||
|
|
||||||
if(img2imgsamplingmethod=="all"):
|
if(originalimg2imgsamplingmethod=="all"):
|
||||||
img2imgsamplingmethod = random.choice(img2imgsamplerlist)
|
img2imgsamplingmethod = random.choice(img2imgsamplerlist)
|
||||||
print ("Going to upscale with sampling method " + img2imgsamplingmethod)
|
print ("Going to upscale with sampling method " + img2imgsamplingmethod)
|
||||||
|
|
||||||
if(img2imgupscaler=="all"):
|
if(originalimg2imgupscaler=="all"):
|
||||||
img2imgupscaler = random.choice(img2imgupscalerlist)
|
img2imgupscaler = random.choice(img2imgupscalerlist)
|
||||||
print ("Going to run with upscaler " + img2imgupscaler)
|
print ("Going to run with upscaler " + img2imgupscaler)
|
||||||
|
|
||||||
# WebUI fix for PLMS and UniPC and img2img
|
# WebUI fix for PLMS and UniPC and img2img
|
||||||
if(img2imgsamplingmethod in ['PLMS', 'UniPC']): # PLMS/UniPC do not support img2img so we just silently switch to DDIM
|
if(img2imgsamplingmethod in ['PLMS', 'UniPC']): # PLMS/UniPC do not support img2img so we just silently switch to DDIM
|
||||||
img2imgsamplingmethod = 'DDIM'
|
img2imgsamplingmethod = 'DDIM'
|
||||||
|
|
||||||
|
img2imgsteps = 0
|
||||||
|
|
||||||
|
# start the batching!
|
||||||
|
img2imgdenoisestrength = originalimg2imgdenoisestrength
|
||||||
|
img2imgpadding = originalimg2imgpadding
|
||||||
|
|
||||||
|
while img2imgsteps < img2imgloops:
|
||||||
|
print(img2imgdenoisestrength)
|
||||||
|
print(img2imgpadding)
|
||||||
|
|
||||||
|
print("test for filename issues?")
|
||||||
|
print(filenamecomplete)
|
||||||
|
|
||||||
|
filenamecomplete = originalfilenamecomplete + "_" + str(img2imgsteps)
|
||||||
|
print(filenamecomplete)
|
||||||
|
|
||||||
img2img = call_img2img(image, originalimage, originalpnginfo, apiurl, filenamecomplete, randomprompt,negativeprompt,img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel, img2imgdenoisestrength, img2imgscale, img2imgpadding,upscalescript,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur,controlnetenabled, controlnetmodel,controlnetblockymode)
|
img2img = call_img2img(image, originalimage, originalpnginfo, apiurl, filenamecomplete, randomprompt,negativeprompt,img2imgsamplingsteps, img2imgcfg, img2imgsamplingmethod, img2imgupscaler, img2imgmodel, img2imgdenoisestrength, img2imgscale, img2imgpadding,upscalescript,usdutilewidth, usdutileheight, usdumaskblur, usduredraw, usduSeamsfix, usdusdenoise, usduswidth, usduspadding, usdusmaskblur,controlnetenabled, controlnetmodel,controlnetblockymode)
|
||||||
|
|
||||||
image = img2img[0]
|
image = img2img[0]
|
||||||
if(originalpnginfo==""):
|
if(originalpnginfo==""):
|
||||||
originalpnginfo = img2img[1]
|
originalpnginfo = img2img[1]
|
||||||
|
|
||||||
img2imgdenoisestrength = str(float(img2imgdenoisestrength) + float(img2imgdenoisestrengthmod)) # lower or increase the denoise strength for each batch
|
img2imgdenoisestrength = str(round(float(img2imgdenoisestrength) + float(img2imgdenoisestrengthmod),2)) # lower or increase the denoise strength for each batch
|
||||||
img2imgpadding = int(int(img2imgpadding) * float(img2imgscale)) # also increase padding by scale
|
img2imgpadding = str(int(int(img2imgpadding) * float(img2imgscale))) # also increase padding by scale
|
||||||
|
|
||||||
if(int(img2imgpadding)>256): # but not overdo it :D
|
if(int(img2imgpadding)>256): # but not overdo it :D
|
||||||
img2imgpadding="256"
|
img2imgpadding="256"
|
||||||
|
|
||||||
|
# Sometimes, we are too quick to do another call, causing memory issues. So we wait a bit to let the system settle done a bit.
|
||||||
|
# Its stupid but it works. Sometimes....
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
img2imgsteps += 1
|
img2imgsteps += 1
|
||||||
|
|
||||||
# upscale via extras upscaler next
|
# upscale via extras upscaler next
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue