yizhangliu commited on
Commit
98baf00
1 Parent(s): bfaf327

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -154,20 +154,21 @@ def model_process(image, mask):
154
  )
155
 
156
  # print(f'config = {config}')
157
-
 
158
  if config.sd_seed == -1:
159
  config.sd_seed = random.randint(1, 999999999)
160
 
161
  # logger.info(f"Origin image shape: {original_shape}")
162
- print(f"Origin image shape: {original_shape} / {type(image)}")
163
  image = resize_max_size(image, size_limit=size_limit, interpolation=interpolation)
164
  # logger.info(f"Resized image shape: {image.shape}")
165
- print(f"Resized image shape: {image.shape} / {type(image)}")
166
 
167
  #mask, _ = load_img(input["mask"].read(), gray=True)
168
  mask = np.array(Image.fromarray(mask).convert("L"))
169
  mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
170
- print(f"mask image shape: {mask.shape} / {type(mask)}")
171
 
172
  if model is None:
173
  return None
@@ -175,6 +176,7 @@ def model_process(image, mask):
175
  start = time.time()
176
  res_np_img = model(image, mask, config)
177
  logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
 
178
 
179
  torch.cuda.empty_cache()
180
 
 
154
  )
155
 
156
  # print(f'config = {config}')
157
+
158
+ print(f'config/alpha_channel/size_limit = {config} / {alpha_channel} / {size_limit}')
159
  if config.sd_seed == -1:
160
  config.sd_seed = random.randint(1, 999999999)
161
 
162
  # logger.info(f"Origin image shape: {original_shape}")
163
+ print(f"Origin image shape: {original_shape} / {image[250][250]}")
164
  image = resize_max_size(image, size_limit=size_limit, interpolation=interpolation)
165
  # logger.info(f"Resized image shape: {image.shape}")
166
+ print(f"Resized image shape: {image.shape} / {image[250][250]}")
167
 
168
  #mask, _ = load_img(input["mask"].read(), gray=True)
169
  mask = np.array(Image.fromarray(mask).convert("L"))
170
  mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
171
+ print(f"mask image shape: {mask.shape} / {type(mask)} / {mask[250][250]}")
172
 
173
  if model is None:
174
  return None
 
176
  start = time.time()
177
  res_np_img = model(image, mask, config)
178
  logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
179
+ print(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape} / {res_np_img[250][250]}")
180
 
181
  torch.cuda.empty_cache()
182