fix gradio (#444)

This commit is contained in:
lllyasviel
2023-09-19 18:30:57 -07:00
committed by GitHub
parent b6752c74e3
commit 098d08cd22
3 changed files with 10 additions and 4 deletions
+6 -1
View File
@@ -5,10 +5,11 @@ import torch
buffer = []
outputs = []
default_image = None
def worker():
global buffer, outputs
global buffer, outputs, default_image
import time
import shared
@@ -45,6 +46,8 @@ def worker():
@torch.no_grad()
@torch.inference_mode()
def handler(task):
global default_image
prompt, negative_prompt, style_selections, performance_selction, \
aspect_ratios_selction, image_number, image_seed, sharpness, \
base_model_name, refiner_model_name, \
@@ -90,6 +93,7 @@ def worker():
progressbar(0, 'Image processing ...')
if current_tab == 'uov' and uov_method != flags.disabled and uov_input_image is not None:
uov_input_image = HWC3(uov_input_image)
default_image = uov_input_image
if 'vary' in uov_method:
if not image_is_generated_in_current_ui(uov_input_image, ui_width=width, ui_height=height):
uov_input_image = resize_image(uov_input_image, width=width, height=height)
@@ -167,6 +171,7 @@ def worker():
if current_tab == 'inpaint' and isinstance(inpaint_input_image, dict):
inpaint_image = inpaint_input_image['image']
inpaint_mask = inpaint_input_image['mask'][:, :, 0]
default_image = inpaint_image
if isinstance(inpaint_image, np.ndarray) and isinstance(inpaint_mask, np.ndarray) \
and (np.any(inpaint_mask > 127) or len(outpaint_selections) > 0):
if len(outpaint_selections) > 0: