fix error messages not appearing
This commit is contained in:
parent
47be7e1f1b
commit
0a85f1afff
16
webui.py
16
webui.py
|
@ -683,7 +683,7 @@ def wrap_gradio_call(func):
|
|||
print("Arguments:", args, kwargs, file=sys.stderr)
|
||||
print(traceback.format_exc(), file=sys.stderr)
|
||||
|
||||
res = [None, f"<div class='error'>{plaintext_to_html(type(e).__name__+': '+str(e))}</div>"]
|
||||
res = [None, '', f"<div class='error'>{plaintext_to_html(type(e).__name__+': '+str(e))}</div>"]
|
||||
|
||||
elapsed = time.perf_counter() - t
|
||||
|
||||
|
@ -1027,6 +1027,18 @@ class KDiffusionSampler:
|
|||
if hasattr(k_diffusion.sampling, 'trange'):
|
||||
k_diffusion.sampling.trange = lambda *args, **kwargs: extended_trange(*args, **kwargs)
|
||||
|
||||
def cb(d):
|
||||
n = d['i']
|
||||
img = d['denoised']
|
||||
|
||||
x_samples_ddim = sd_model.decode_first_stage(img)
|
||||
x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0)
|
||||
for i, x_sample in enumerate(x_samples_ddim):
|
||||
x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2)
|
||||
x_sample = x_sample.astype(np.uint8)
|
||||
image = Image.fromarray(x_sample)
|
||||
image.save(f'a/{n}.png')
|
||||
|
||||
samples_ddim = self.func(self.model_wrap_cfg, x, sigmas, extra_args={'cond': conditioning, 'uncond': unconditional_conditioning, 'cond_scale': p.cfg_scale}, disable=False)
|
||||
return samples_ddim
|
||||
|
||||
|
@ -1989,7 +2001,7 @@ else:
|
|||
sd_model = sd_model.to(device)
|
||||
|
||||
model_hijack = StableDiffusionModelHijack()
|
||||
model_hijack.hijack(sd_model)
|
||||
#model_hijack.hijack(sd_model)
|
||||
|
||||
with open(os.path.join(script_path, "style.css"), "r", encoding="utf8") as file:
|
||||
css = file.read()
|
||||
|
|
Loading…
Reference in New Issue
Block a user