fix gradio again again again (#453)

This commit is contained in:
lllyasviel
2023-09-20 04:12:19 -07:00
committed by GitHub
parent c9ec6e22ad
commit 65b9364170
4 changed files with 476 additions and 12 deletions
+1 -6
View File
@@ -5,11 +5,10 @@ import torch
buffer = []
outputs = []
default_image = None
def worker():
global buffer, outputs, default_image
global buffer, outputs
import time
import shared
@@ -46,8 +45,6 @@ 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, \
@@ -93,7 +90,6 @@ 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)
@@ -171,7 +167,6 @@ 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: