do not try to save base64 intermediates in gallery on cancellation

This commit is contained in:
damian0815 2022-11-01 12:54:46 +01:00 committed by Lincoln Stein
parent 4013e8ad6f
commit 7c5305ccba
6 changed files with 536 additions and 845 deletions

View File

@ -642,12 +642,12 @@ class InvokeAIWebServer:
(width, height) = image.size
buffered = io.BytesIO()
image.save(buffered, format="PNG")
img_str = base64.b64encode(buffered.getvalue()).decode('UTF-8')
img_base64 = "data:image/jpeg;base64," + img_str
img_base64 = "data:image/jpeg;base64," + base64.b64encode(buffered.getvalue()).decode('UTF-8')
self.socketio.emit(
"intermediateResult",
{
"url": img_base64,
"isBase64": True,
"mtime": 0,
"metadata": {},
"width": width,

File diff suppressed because one or more lines are too long

517
frontend/dist/assets/index.e2832fd4.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvokeAI - A Stable Diffusion Toolkit</title>
<link rel="shortcut icon" type="icon" href="./assets/favicon.0d253ced.ico" />
<script type="module" crossorigin src="./assets/index.4488003f.js"></script>
<script type="module" crossorigin src="./assets/index.e2832fd4.js"></script>
<link rel="stylesheet" href="./assets/index.52c8231e.css">
</head>

View File

@ -116,6 +116,7 @@ export declare type Image = {
width: number;
height: number;
category: GalleryCategory;
isBase64: boolean;
};
// GalleryImages is an array of Image.

View File

@ -261,6 +261,7 @@ const makeSocketIOListeners = (
const { intermediateImage } = getState().gallery;
if (intermediateImage) {
if (!intermediateImage.isBase64) {
dispatch(
addImage({
category: 'result',
@ -273,6 +274,7 @@ const makeSocketIOListeners = (
message: `Intermediate image saved: ${intermediateImage.url}`,
})
);
}
dispatch(clearIntermediateImage());
}