aryrk commited on
Commit
148563e
·
1 Parent(s): 95f6ecc

[feat] update load size and crop size

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -42,13 +42,16 @@ def reflection_removal(input_image):
42
 
43
  input_filename = os.path.splitext(os.path.basename(file_path))[0]
44
 
45
- aspect_ratio = 1.0
 
46
 
47
  try:
48
  with Image.open(file_path) as img:
49
  width, height = img.size
50
- aspect_ratio = width / height
51
- print(f"Aspect Ratio: {aspect_ratio}")
 
 
52
  except Exception as e:
53
  pass
54
 
@@ -61,7 +64,8 @@ def reflection_removal(input_image):
61
  "--norm", "batch", "--epoch", "310",
62
  "--num_test", str(count_files(UPLOAD_DIR)),
63
  "--gpu_ids", "-1",
64
- "--aspect_ratio", str(aspect_ratio)
 
65
  ]
66
  subprocess.run(cmd, check=True)
67
 
 
42
 
43
  input_filename = os.path.splitext(os.path.basename(file_path))[0]
44
 
45
+ load_size = 286
46
+ crop_size = 256
47
 
48
  try:
49
  with Image.open(file_path) as img:
50
  width, height = img.size
51
+ load_size = max(width, height)
52
+ crop_size = min(width, height)
53
+ print(f"Image Dimensions: {width}x{height}")
54
+ print(f"load_size: {load_size}, crop_size: {crop_size}")
55
  except Exception as e:
56
  pass
57
 
 
64
  "--norm", "batch", "--epoch", "310",
65
  "--num_test", str(count_files(UPLOAD_DIR)),
66
  "--gpu_ids", "-1",
67
+ "--load_size", str(load_size),
68
+ "--crop_size", str(crop_size),
69
  ]
70
  subprocess.run(cmd, check=True)
71