mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Squashed commit of the following:
commit 7d1344282d942a33dcecda4d5144fc154ec82915 Merge:caf4ea3
ebeb556
Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Sep 5 10:07:27 2022 -0400 Merge branch 'development' of github.com:WebDev9000/stable-diffusion into WebDev9000-development commitebeb556af9
Author: Web Dev 9000 <rirath@gmail.com> Date: Sun Sep 4 18:05:15 2022 -0700 Fixed unintentionally removed lines commitff2c4b9a1b
Author: Web Dev 9000 <rirath@gmail.com> Date: Sun Sep 4 17:50:13 2022 -0700 Add ability to recreate variations via image click commitc012929cda
Author: Web Dev 9000 <rirath@gmail.com> Date: Sun Sep 4 14:35:33 2022 -0700 Add files via upload commit02a6018992
Author: Web Dev 9000 <rirath@gmail.com> Date: Sun Sep 4 14:35:07 2022 -0700 Add files via upload
This commit is contained in:
@ -75,6 +75,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
||||
seamless = 'seamless' in post_data
|
||||
cfgscale = float(post_data['cfgscale'])
|
||||
sampler_name = post_data['sampler']
|
||||
variation_amount = float(post_data['variation_amount'])
|
||||
with_variations = post_data['with_variations']
|
||||
gfpgan_strength = float(post_data['gfpgan_strength']) if gfpgan_model_exists else 0
|
||||
upscale_level = post_data['upscale_level']
|
||||
upscale_strength = post_data['upscale_strength']
|
||||
@ -82,6 +84,30 @@ class DreamServer(BaseHTTPRequestHandler):
|
||||
progress_images = 'progress_images' in post_data
|
||||
seed = self.model.seed if int(post_data['seed']) == -1 else int(post_data['seed'])
|
||||
|
||||
if with_variations != '':
|
||||
parts = []
|
||||
broken = False
|
||||
for part in with_variations.split(','):
|
||||
seed_and_weight = part.split(':')
|
||||
if len(seed_and_weight) != 2:
|
||||
print(f'could not parse with_variation part "{part}"')
|
||||
broken = True
|
||||
break
|
||||
try:
|
||||
vseed = int(seed_and_weight[0])
|
||||
vweight = float(seed_and_weight[1])
|
||||
except ValueError:
|
||||
print(f'could not parse with_variation part "{part}"')
|
||||
broken = True
|
||||
break
|
||||
parts.append([vseed, vweight])
|
||||
if broken:
|
||||
raise CanceledException
|
||||
if len(parts) > 0:
|
||||
with_variations = parts
|
||||
else:
|
||||
with_variations = None
|
||||
|
||||
self.canceled.clear()
|
||||
print(f">> Request to generate with prompt: {prompt}")
|
||||
# In order to handle upscaled images, the PngWriter needs to maintain state
|
||||
@ -163,6 +189,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
||||
height = height,
|
||||
seed = seed,
|
||||
steps = steps,
|
||||
variation_amount = variation_amount,
|
||||
with_variations = with_variations,
|
||||
gfpgan_strength = gfpgan_strength,
|
||||
upscale = upscale,
|
||||
sampler_name = sampler_name,
|
||||
@ -184,6 +212,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
||||
cfg_scale = cfgscale,
|
||||
seed = seed,
|
||||
steps = steps,
|
||||
variation_amount = variation_amount,
|
||||
with_variations = with_variations,
|
||||
sampler_name = sampler_name,
|
||||
width = width,
|
||||
height = height,
|
||||
|
Reference in New Issue
Block a user