first fix for out of mem issues

pull/89/head
AIrjen 2023-07-17 21:19:10 +02:00
parent 4d817fbff6
commit 0a89c8673a
8 changed files with 235 additions and 42 deletions

View File

@ -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,

View File

@ -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

1 50s Art
10 Academism
11 Action Painting
12 Aestheticism
13 Aetherpunk
14 Afrofuturism
15 Afropunk
16 Altermodern
32 Ashcan School
33 Atomicpunk
34 Atompunk
35 Astropunk
36 Auroracore
37 Australian Tonalism
38 Auto-Destructive Art
87 Cyberpunk Art
88 Dada Art
89 Dark Wave Art
90 Darksynth
91 Darkcore
92 Darkpunk
93 De Stijl
94 Deathpunk
95 Decopunk
96 Decora
97 decal art
98 Demoscene
99 Destructive Art
100 Dieselpunk
101 Digital Art
102 divisionism
103 dmt
104 Dollpunk
105 Doodle Art style
120 Fauvism
121 Feralcore
122 Figurative Art
123 Flat Art
124 Fluxus Art
125 Folk Art
126 Funk Art
131 Gamerpunk
132 Generative Art
133 Geometric Abstract Art
134 Geometric Style
135 Glitch Art
136 Glitchcore
137 Gloomcore
140 Glowwave
141 Goblincore
142 Goth Art
143 Gouache Art
144 Graffiti Street Art
145 Grindhouse
146 Grimdark
147 Grunge Art
148 Grungepunk
149 Gutai Group
164 Impressionism
165 Industrial Art
166 Islandpunk
167 Impasto
168 Junglecore
169 Kawaii anime
170 kalighat
171 Kinetic Pointillism
172 kinetic art
173 Kingcore
174 Knightcore
175 Land Art
176 Letterism
177 Libertywave
178 Lightcore
179 Lowbrow Art
183 Magical Realism
184 Mannerism Art
185 Margins Art
186 Medieval art
187 Memecore Art
188 Metalcore
189 Methaphysical painting
195 Modern Art
196 Modern European Ink Painting
197 Modernism Art
198 monotype
199 mosaic
200 Mushroomcore
201 Mythpunk
202 Naive Art
219 Orientalism Art
220 Orphism
221 Panfuturism
222 Patachitra
223 Pastel Goth Art
224 Photorealism
225 Pin-up
226 Pixel Art
227 Pixiecore
228 Pointillism
278 Synthwave Art
279 Tattoo style
280 Terrorwave
281 Technopunk
282 Tenebrism
283 Teslapunk
284 Thriftcore
285 Tinkercore
300 Vorticism Art
301 Voxel Art
302 Warmcore
303 Westernpunk
304 Weirdcore
305 Witchcore
306 Wizardcore

View File

@ -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
1 RAW photo
7 Painting
8 Drawing
9 Vector Art
Gopro footage
CCTV
Drone photo
Thermal camera
10 Water color painting
11 Oil painting
12 wall Graffiti
30 portrait
31 Raw digital photo
32 Airbrush painting
33 On pale black paper
34 Anime

View File

@ -117,4 +117,5 @@ Diamond
Garment Garment
Galaxy Galaxy
Stars Stars
-space- -space-
Lapidary
1 Wood
117 Garment
118 Galaxy
119 Stars
120 -space-
121 Lapidary

View File

@ -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
1 Concept sheet
110 acrylic painting
111 acrylic pour
112 board game
claymation
113 cloisonné
114 Doom engine
115 Quake engine
144 stop motion
145 traditional Haida art
146 traditional Sámi art
147 x-ray photography
148 Gopro footage
149 CCTV
150 Drone photo
151 Thermal camera
152 50s illustration style
153 60s illustration style
154 70s illustration style
155 80s illustration style
156 90s illustration style
157 doll
158 action figure
159 action painting art
160 alcohol ink art
161 alcohol ink drawing
162 alebrije art
163 ASCII art
164 assemblage art
165 azulejo texture
166 bas-relief art
167 bestiary
168 black ink art
169 blacklight palette
170 brush pen art
171 caricature art
172 carving technique
173 cast paper art
174 catholic icon
175 ceramic figurine
176 charcoal art
177 chiaroscuro art
178 child's drawing
179 cibulak porcelain technique
180 collagraph technique
181 color sketchnote drawing
182 colored pencil drawing
183 comic book art
184 comics art
185 continuous line art
186 contour drawing
187 contour rivalry drawing
188 cross stitch
189 cross-stitching technique
190 cutout art
191 decoupage technique
192 diagram
193 doodling drawing
194 dotted lines art
195 dribbble style
196 hieroglyphs
197 embossing
198 enamel painting art
199 encaustic texture
200 engraving drawing
201 etching technique
202 fashion illustration
203 felt tip pen drawing
204 fresco art
205 fused glass art
206 gilded drawing
207 gobelin tapestry technique
208 gold leafing technique
209 gond painting
210 graffiti print
211 graphic print
212 graphite
213 hologram
214 ink wash art
215 inktober drawing
216 ivory carving technique
217 iznik tiles pattern
218 -culture- vintage poster print
219 kachina doll
220 kirigami art
221 letterpress print
222 linocut drawing
223 lithography print
224 loose sketching drawing
225 low-poly drawing
226 marquetry
227 millefiori
228 Paint splatter
229 palette knife art
230 paper quilling art
231 papercut art
232 papier-mache art
233 patachitra painting
234 patchwork
235 pebble art
236 pen drawing
237 plasticine
238 pyrography
239 quilted art
240 recycled art
241 relief art
242 risograph print
243 scribble art
244 sgraffito drawing
245 silhouette art
246 silk screen
247 sloppy strokes drawing
248 sock puppet
249 stencil art
250 stuffed toy
251 sumi-e outline
252 swirling line drawing
253 tilt and drip drawing
254 tilt and drip painting art
255 underpainting art
256 wireframe drawing
257 woodblock print
258 woodcut drawing
259 woodcut technique
260 zig-zag lines drawing

View File

@ -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
1 (-color- and -color-:0.7)
54 geometric patterns
55 glimmering transformation
56 glittering
57 glitter texture
58 gilded technique
59 Golden ratio
60 halation
61 halftone texture
62 hearthstone artwork
63 icon style
64 Instagram
65 intricate details
66 intricate
78 MOBA style
79 moody
80 Movie concept art
81 multidimensional
82 National Geographic
83 opulent
84 otherworldly
95 rpg concept art
96 Rule of Thirds
97 sfumato
98 sgraffito
99 sloppy strokes
100 silhouette
101 Simplified style
102 Spirals
108 Swirling -material-
109 symbolism
110 taiji
111 triadic
112 under water
113 underpainting
114 vibrant
115 vignette
116 vintage
117 Zentangle

View File

@ -27,4 +27,6 @@ Bath
Shower Shower
Sauna Sauna
Spa Spa
Thermal baths Thermal baths
Thermae
-culture- bath
1 River
27 Shower
28 Sauna
29 Spa
30 Thermal baths
31 Thermae
32 -culture- bath

108
main.py
View File

@ -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