haritsahm commited on
Commit
dbe6ca0
·
1 Parent(s): fde18f6

Add input image resizer

Browse files
Files changed (1) hide show
  1. main.py +3 -0
main.py CHANGED
@@ -18,6 +18,7 @@ BILATERAL_MODEL.load_state_dict(torch.load(
18
  BILATERIAL_WEIGHT, map_location='cpu'))
19
  BILATERAL_MODEL = BILATERAL_MODEL.to('cpu')
20
  BILATERAL_MODEL.eval()
 
21
 
22
  OUTPUT_GALLERY = gr.Gallery(
23
  label='Highlighted Area').style(grid=[2], height='auto')
@@ -127,6 +128,8 @@ def predict_bilateral(files):
127
  image = np.array(Image.open(str(path)))
128
  image = cv2.normalize(
129
  image, None, 0, 255, cv2.NORM_MINMAX, dtype=cv2.CV_8U)
 
 
130
 
131
  images.append(image)
132
 
 
18
  BILATERIAL_WEIGHT, map_location='cpu'))
19
  BILATERAL_MODEL = BILATERAL_MODEL.to('cpu')
20
  BILATERAL_MODEL.eval()
21
+ INPUT_HEIGHT, INPUT_WIDTH = 600, 500
22
 
23
  OUTPUT_GALLERY = gr.Gallery(
24
  label='Highlighted Area').style(grid=[2], height='auto')
 
128
  image = np.array(Image.open(str(path)))
129
  image = cv2.normalize(
130
  image, None, 0, 255, cv2.NORM_MINMAX, dtype=cv2.CV_8U)
131
+ image = cv2.resize(
132
+ image, (INPUT_WIDTH, INPUT_HEIGHT), interpolation=cv2.INTER_LINEAR)
133
 
134
  images.append(image)
135