rashid996958 commited on
Commit
3cce8ac
·
1 Parent(s): fe07cf7

resize output image

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -10,7 +10,7 @@ pb = 'dmt.pb'
10
  style_dim = 8
11
  img_size=256
12
 
13
- model_scale = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=3)
14
 
15
  def preprocess(img):
16
  return (img / 255. - 0.5) * 2
@@ -47,7 +47,7 @@ def inference(A,B):
47
  image = Image.fromarray(output)
48
  inputs = ImageLoader.load_image(image)
49
  preds = model_scale(inputs)
50
- ImageLoader.save_image(preds, 'output/scaled_3x.png')
51
 
52
 
53
 
@@ -62,12 +62,8 @@ def makeupTransfer(arr1,arr2):
62
  no_makeup = "input/original.png"
63
  makeup = "input/ref.png"
64
  inference(no_makeup, makeup)
65
- img = cv2.imread("output/scaled_3x.png")
66
- h,w,_ = img.shape
67
- h_new = 256
68
- w_new = int((256/h)*w)
69
- resize_img = cv2.resize(img,(w_new,h_new))
70
- return cv2.cvtColor(resize_img, cv2.COLOR_BGR2RGB)
71
 
72
 
73
  examples = [['faces/no_makeup/xfsy_0226.png', 'faces/makeup/XMY-136.png'],
 
10
  style_dim = 8
11
  img_size=256
12
 
13
+ model_scale = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2)
14
 
15
  def preprocess(img):
16
  return (img / 255. - 0.5) * 2
 
47
  image = Image.fromarray(output)
48
  inputs = ImageLoader.load_image(image)
49
  preds = model_scale(inputs)
50
+ ImageLoader.save_image(preds, 'output/scaled_2x.png')
51
 
52
 
53
 
 
62
  no_makeup = "input/original.png"
63
  makeup = "input/ref.png"
64
  inference(no_makeup, makeup)
65
+ img = cv2.imread("output/scaled_2x.png")
66
+ return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
 
 
 
 
67
 
68
 
69
  examples = [['faces/no_makeup/xfsy_0226.png', 'faces/makeup/XMY-136.png'],