ZhengPeng7 commited on
Commit
4a3bbdd
1 Parent(s): 53ff575

Change all predicted results as refined RGBA images. Fix a typo in device specification.

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -6,7 +6,7 @@ import gradio as gr
6
  import spaces
7
 
8
  from glob import glob
9
- from typing import Optional, Tuple
10
 
11
  from PIL import Image
12
  from gradio_imageslider import ImageSlider
@@ -58,16 +58,10 @@ def FB_blur_fusion_foreground_estimator(image, F, B, alpha, r=90):
58
  return F, blurred_B
59
 
60
 
61
- def array_to_pil_image(image: np.ndarray, size: Tuple[int, int] = (1024, 1024)) -> Image.Image:
62
- image = cv2.resize(image, size, interpolation=cv2.INTER_LINEAR)
63
- image = Image.fromarray(image).convert('RGB')
64
- return image
65
-
66
-
67
  class ImagePreprocessor():
68
  def __init__(self, resolution: Tuple[int, int] = (1024, 1024)) -> None:
69
  self.transform_image = transforms.Compose([
70
- # transforms.Resize(resolution), # 1. keep consistent with the cv2.resize used in training 2. redundant with that in path_to_image()
71
  transforms.ToTensor(),
72
  transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
73
  ])
 
6
  import spaces
7
 
8
  from glob import glob
9
+ from typing import Tuple
10
 
11
  from PIL import Image
12
  from gradio_imageslider import ImageSlider
 
58
  return F, blurred_B
59
 
60
 
 
 
 
 
 
 
61
  class ImagePreprocessor():
62
  def __init__(self, resolution: Tuple[int, int] = (1024, 1024)) -> None:
63
  self.transform_image = transforms.Compose([
64
+ transforms.Resize(resolution), # 1. keep consistent with the cv2.resize used in training 2. redundant with that in path_to_image()
65
  transforms.ToTensor(),
66
  transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
67
  ])