From 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 1 Nov 2022 21:54:35 +1100 Subject: [PATCH] Fixes b64 image sending and displaying --- backend/invoke_ai_web_server.py | 4 ++-- frontend/src/features/gallery/CurrentImageButtons.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/invoke_ai_web_server.py b/backend/invoke_ai_web_server.py index 0493e99b59..7a474a68d0 100644 --- a/backend/invoke_ai_web_server.py +++ b/backend/invoke_ai_web_server.py @@ -642,8 +642,8 @@ class InvokeAIWebServer: (width, height) = image.size buffered = io.BytesIO() image.save(buffered, format="PNG") - img_str = base64.b64encode(buffered.getvalue()) - img_base64 = bytes("data:image/jpeg;base64,", encoding='utf-8') + img_str + img_str = base64.b64encode(buffered.getvalue()).decode('UTF-8') + img_base64 = "data:image/jpeg;base64," + img_str self.socketio.emit( "intermediateResult", { diff --git a/frontend/src/features/gallery/CurrentImageButtons.tsx b/frontend/src/features/gallery/CurrentImageButtons.tsx index 4837530749..4bd5641824 100644 --- a/frontend/src/features/gallery/CurrentImageButtons.tsx +++ b/frontend/src/features/gallery/CurrentImageButtons.tsx @@ -44,13 +44,13 @@ const systemSelector = createSelector( [ (state: RootState) => state.system, (state: RootState) => state.options, - intermediateImageSelector, + (state: RootState) => state.gallery, activeTabNameSelector, ], ( system: SystemState, options: OptionsState, - intermediateImage, + gallery: GalleryState, activeTabName ) => { const { isProcessing, isConnected, isGFPGANAvailable, isESRGANAvailable } = @@ -59,6 +59,8 @@ const systemSelector = createSelector( const { upscalingLevel, facetoolStrength, shouldShowImageDetails } = options; + const { intermediateImage } = gallery; + return { isProcessing, isConnected,