Skip to content

Commit 92ad000

Browse files
committed
fix: height and width app check
1 parent 187a314 commit 92ad000

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

app.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ def build_canvas(input_image_path, resized_height, resized_width, top_left_heigh
314314
visual_canvas = np.full((expand_height, expand_width, 3), canvas_color, dtype=np.uint8)
315315

316316

317+
# Sanity Check
318+
if expand_height % 32 != 0:
319+
raise gr.Error("The Height of resized_height + top_left_height + bottom_right_height must be divisible by 32!")
320+
if expand_width % 32 != 0:
321+
raise gr.Error("The Width of resized_width + top_left_width + bottom_right_width must be divisible by 32!")
322+
323+
317324
# Draw the Region Box Region (Original Resolution)
318325
bottom_len = inference_canvas.shape[0] - bottom_right_height
319326
right_len = inference_canvas.shape[1] - bottom_right_width
@@ -326,13 +333,6 @@ def build_canvas(input_image_path, resized_height, resized_width, top_left_heigh
326333

327334

328335

329-
330-
331-
# TODO: Should Check if the height and width is the multiplier of 32 and then if the resolution is preferred.
332-
333-
334-
335-
336336
# Return the visual_canvas (for visualizaiton) and canvas map
337337
# Corresponds to: visual_canvas, initial_visual_canvas, inference_canvas, traj_instance_idx, traj_lists
338338
return visual_canvas, visual_canvas.copy(), inference_canvas, 0, [ [ [] ] ] # The last two is initialized with the trajectory instance idx and trajectory list

0 commit comments

Comments
 (0)