swzamir commited on
Commit
cae5c8c
1 Parent(s): 2b817c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -30,16 +30,14 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.098
30
 
31
  def inference(img,task):
32
  os.system('mkdir temp')
33
- max_res = 904
 
 
34
  width, height = img.size
35
  if max(width,height) > max_res:
36
- scale = min(width,height)/max(width,height)
37
- if width > max_res:
38
- width = max_res
39
- height = int(scale*max_res)
40
- if height > max_res:
41
- height = max_res
42
- width = int(scale*max_res)
43
  img = img.resize((width,height), Image.ANTIALIAS)
44
 
45
  img.save("temp/image.jpg", "JPEG")
 
30
 
31
  def inference(img,task):
32
  os.system('mkdir temp')
33
+
34
+ # Resize the longer edge of the input image
35
+ max_res = 512
36
  width, height = img.size
37
  if max(width,height) > max_res:
38
+ scale = max_res /max(width,height)
39
+ width = int(scale*width)
40
+ height = int(scale*height)
 
 
 
 
41
  img = img.resize((width,height), Image.ANTIALIAS)
42
 
43
  img.save("temp/image.jpg", "JPEG")