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:
parent
eef788981c
commit
f6284777e6
@ -75,6 +75,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
seamless = 'seamless' in post_data
|
seamless = 'seamless' in post_data
|
||||||
cfgscale = float(post_data['cfgscale'])
|
cfgscale = float(post_data['cfgscale'])
|
||||||
sampler_name = post_data['sampler']
|
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
|
gfpgan_strength = float(post_data['gfpgan_strength']) if gfpgan_model_exists else 0
|
||||||
upscale_level = post_data['upscale_level']
|
upscale_level = post_data['upscale_level']
|
||||||
upscale_strength = post_data['upscale_strength']
|
upscale_strength = post_data['upscale_strength']
|
||||||
@ -82,6 +84,30 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
progress_images = 'progress_images' in post_data
|
progress_images = 'progress_images' in post_data
|
||||||
seed = self.model.seed if int(post_data['seed']) == -1 else int(post_data['seed'])
|
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()
|
self.canceled.clear()
|
||||||
print(f">> Request to generate with prompt: {prompt}")
|
print(f">> Request to generate with prompt: {prompt}")
|
||||||
# In order to handle upscaled images, the PngWriter needs to maintain state
|
# In order to handle upscaled images, the PngWriter needs to maintain state
|
||||||
@ -163,6 +189,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
height = height,
|
height = height,
|
||||||
seed = seed,
|
seed = seed,
|
||||||
steps = steps,
|
steps = steps,
|
||||||
|
variation_amount = variation_amount,
|
||||||
|
with_variations = with_variations,
|
||||||
gfpgan_strength = gfpgan_strength,
|
gfpgan_strength = gfpgan_strength,
|
||||||
upscale = upscale,
|
upscale = upscale,
|
||||||
sampler_name = sampler_name,
|
sampler_name = sampler_name,
|
||||||
@ -184,6 +212,8 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
cfg_scale = cfgscale,
|
cfg_scale = cfgscale,
|
||||||
seed = seed,
|
seed = seed,
|
||||||
steps = steps,
|
steps = steps,
|
||||||
|
variation_amount = variation_amount,
|
||||||
|
with_variations = with_variations,
|
||||||
sampler_name = sampler_name,
|
sampler_name = sampler_name,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
|
@ -125,6 +125,9 @@ label {
|
|||||||
#txt2img {
|
#txt2img {
|
||||||
background-color: #DCDCDC;
|
background-color: #DCDCDC;
|
||||||
}
|
}
|
||||||
|
#variations {
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
}
|
||||||
#img2img {
|
#img2img {
|
||||||
background-color: #F5F5F5;
|
background-color: #F5F5F5;
|
||||||
}
|
}
|
||||||
|
@ -68,15 +68,19 @@
|
|||||||
<option value="832">832</option> <option value="896">896</option>
|
<option value="832">832</option> <option value="896">896</option>
|
||||||
<option value="960">960</option> <option value="1024">1024</option>
|
<option value="960">960</option> <option value="1024">1024</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label title="Set to -1 for random seed" for="seed">Seed:</label>
|
<label title="Set to -1 for random seed" for="seed">Seed:</label>
|
||||||
<input value="-1" type="number" id="seed" name="seed">
|
<input value="-1" type="number" id="seed" name="seed">
|
||||||
<button type="button" id="reset-seed">↺</button>
|
<button type="button" id="reset-seed">↺</button>
|
||||||
<input type="checkbox" name="progress_images" id="progress_images">
|
<input type="checkbox" name="progress_images" id="progress_images">
|
||||||
<label for="progress_images">Display in-progress images (slower):</label>
|
<label for="progress_images">Display in-progress images (slower)</label>
|
||||||
<button type="button" id="reset-all">Reset to Defaults</button>
|
<button type="button" id="reset-all">Reset to Defaults</button>
|
||||||
</fieldset>
|
<div id="variations">
|
||||||
<fieldset id="img2img">
|
<label title="If > 0, generates variations on the initial seed instead of random seeds per iteration. Must be between 0 and 1. Higher values will be more different." for="variation_amount">Variation amount (0 to disable):</label>
|
||||||
|
<input value="0" type="number" id="variation_amount" name="variation_amount" step="0.01" min="0" max="1">
|
||||||
|
<label title="list of variations to apply, in the format `seed:weight,seed:weight,..." for="with_variations">With variations (seed:weight,seed:weight,...):</label>
|
||||||
|
<input value="" type="text" id="with_variations" name="with_variations">
|
||||||
|
</div>
|
||||||
|
<div id="img2img">
|
||||||
<label title="Upload an image to use img2img" for="initimg">Initial image:</label>
|
<label title="Upload an image to use img2img" for="initimg">Initial image:</label>
|
||||||
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
|
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
|
||||||
<button type="button" id="remove-image">Remove Image</button>
|
<button type="button" id="remove-image">Remove Image</button>
|
||||||
@ -85,6 +89,7 @@
|
|||||||
<input value="0.75" type="number" id="strength" name="strength" step="0.01" min="0" max="1">
|
<input value="0.75" type="number" id="strength" name="strength" step="0.01" min="0" max="1">
|
||||||
<input type="checkbox" id="fit" name="fit" checked>
|
<input type="checkbox" id="fit" name="fit" checked>
|
||||||
<label title="Rescale image to fit within requested width and height" for="fit">Fit to width/height:</label>
|
<label title="Rescale image to fit within requested width and height" for="fit">Fit to width/height:</label>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="gfpgan">
|
<fieldset id="gfpgan">
|
||||||
<label title="Strength of the gfpgan (face fixing) algorithm." for="gfpgan_strength">GPFGAN Strength (0 to disable):</label>
|
<label title="Strength of the gfpgan (face fixing) algorithm." for="gfpgan_strength">GPFGAN Strength (0 to disable):</label>
|
||||||
@ -105,7 +110,7 @@
|
|||||||
<progress id="progress-bar" value="0" max="1"></progress>
|
<progress id="progress-bar" value="0" max="1"></progress>
|
||||||
<span id="cancel-button" title="Cancel">✖</span>
|
<span id="cancel-button" title="Cancel">✖</span>
|
||||||
<br>
|
<br>
|
||||||
<img id="progress-image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>'></img>
|
<img id="progress-image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>'>
|
||||||
<div id="scaling-inprocess-message">
|
<div id="scaling-inprocess-message">
|
||||||
<i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i>
|
<i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,7 +28,22 @@ function appendOutput(src, seed, config) {
|
|||||||
if (k == 'initimg') { continue; }
|
if (k == 'initimg') { continue; }
|
||||||
form.querySelector(`*[name=${k}]`).value = config[k];
|
form.querySelector(`*[name=${k}]`).value = config[k];
|
||||||
}
|
}
|
||||||
|
if (config.variation_amount > 0 || config.with_variations != '') {
|
||||||
|
document.querySelector("#seed").value = config.seed;
|
||||||
|
} else {
|
||||||
document.querySelector("#seed").value = seed;
|
document.querySelector("#seed").value = seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.variation_amount > 0) {
|
||||||
|
let oldVarAmt = document.querySelector("#variation_amount").value
|
||||||
|
let oldVariations = document.querySelector("#with_variations").value
|
||||||
|
let varSep = ''
|
||||||
|
document.querySelector("#variation_amount").value = 0;
|
||||||
|
if (document.querySelector("#with_variations").value != '') {
|
||||||
|
varSep = ","
|
||||||
|
}
|
||||||
|
document.querySelector("#with_variations").value = oldVariations + varSep + seed + ':' + config.variation_amount
|
||||||
|
}
|
||||||
|
|
||||||
saveFields(document.querySelector("#generate-form"));
|
saveFields(document.querySelector("#generate-form"));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user