Spaces:
Sleeping
Sleeping
aryrk commited on
Commit ·
c55e3ef
1
Parent(s): 148563e
[feat] update load size and crop size
Browse files
app.py
CHANGED
|
@@ -42,18 +42,6 @@ def reflection_removal(input_image):
|
|
| 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 |
|
| 58 |
cmd = [
|
| 59 |
"python", "test.py",
|
|
@@ -64,8 +52,7 @@ def reflection_removal(input_image):
|
|
| 64 |
"--norm", "batch", "--epoch", "310",
|
| 65 |
"--num_test", str(count_files(UPLOAD_DIR)),
|
| 66 |
"--gpu_ids", "-1",
|
| 67 |
-
"--
|
| 68 |
-
"--crop_size", str(crop_size),
|
| 69 |
]
|
| 70 |
subprocess.run(cmd, check=True)
|
| 71 |
|
|
|
|
| 42 |
|
| 43 |
input_filename = os.path.splitext(os.path.basename(file_path))[0]
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
cmd = [
|
| 47 |
"python", "test.py",
|
|
|
|
| 52 |
"--norm", "batch", "--epoch", "310",
|
| 53 |
"--num_test", str(count_files(UPLOAD_DIR)),
|
| 54 |
"--gpu_ids", "-1",
|
| 55 |
+
"--preprocess", "scale_width_and_crop",
|
|
|
|
| 56 |
]
|
| 57 |
subprocess.run(cmd, check=True)
|
| 58 |
|