HikariDawn commited on
Commit
eea070b
·
1 Parent(s): ad2fde6

docs: update

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -261,10 +261,12 @@ def on_example_click(
261
 
262
 
263
  # Sequentially build the canvas (We don't accept the empty traj_lists & traj_instance_idx returned by build_canvas)
 
264
  visual_canvas, initial_visual_canvas, inference_canvas, _, _ = build_canvas(input_image, resized_height, resized_width, top_left_height, top_left_width, bottom_right_height, bottom_right_width)
265
 
266
 
267
  # Sequentially load the Trajs of all instances on the canvas
 
268
  visual_canvas, traj_instance_idx = fn_vis_all_instance_traj(visual_canvas, traj_lists)
269
 
270
 
@@ -307,16 +309,20 @@ def build_canvas(input_image_path, resized_height, resized_width, top_left_heigh
307
 
308
  # Read the original image and preprare the placeholder
309
  first_frame_img = np.uint8(np.asarray(Image.open(input_image_path))) # NOTE: this is BGR form, be careful for the later cropping process for ID Reference
310
- # print("first_frame_img shape is ", first_frame_img.shape)
 
311
 
312
  # Resize to a uniform resolution
313
  first_frame_img = cv2.resize(first_frame_img, (resized_width, resized_height), interpolation = cv2.INTER_AREA)
 
 
314
 
315
  # Expand to Outside Region to form the Canvas
316
  expand_height = resized_height + top_left_height + bottom_right_height
317
  expand_width = resized_width + top_left_width + bottom_right_width
318
  inference_canvas = np.uint8(np.zeros((expand_height, expand_width, 3))) # Whole Black Canvas, same as other inference
319
  visual_canvas = np.full((expand_height, expand_width, 3), canvas_color, dtype=np.uint8)
 
320
 
321
 
322
  # Sanity Check
@@ -335,7 +341,7 @@ def build_canvas(input_image_path, resized_height, resized_width, top_left_heigh
335
 
336
  # Resize to the uniform height and width
337
  visual_canvas = cv2.resize(visual_canvas, (uniform_width, uniform_height), interpolation = cv2.INTER_AREA)
338
-
339
 
340
 
341
  # Return the visual_canvas (for visualizaiton) and canvas map
@@ -512,7 +518,7 @@ def sample_traj_by_length(points, num_samples):
512
 
513
 
514
 
515
- @spaces.GPU(duration=200)
516
  def inference(inference_canvas, visual_canvas, text_prompt, traj_lists, main_reference_img,
517
  resized_height, resized_width, top_left_height, top_left_width, bottom_right_height, bottom_right_width):
518
 
 
261
 
262
 
263
  # Sequentially build the canvas (We don't accept the empty traj_lists & traj_instance_idx returned by build_canvas)
264
+ print("Build Canvas by Example!")
265
  visual_canvas, initial_visual_canvas, inference_canvas, _, _ = build_canvas(input_image, resized_height, resized_width, top_left_height, top_left_width, bottom_right_height, bottom_right_width)
266
 
267
 
268
  # Sequentially load the Trajs of all instances on the canvas
269
+ print("Build Traj by Example!")
270
  visual_canvas, traj_instance_idx = fn_vis_all_instance_traj(visual_canvas, traj_lists)
271
 
272
 
 
309
 
310
  # Read the original image and preprare the placeholder
311
  first_frame_img = np.uint8(np.asarray(Image.open(input_image_path))) # NOTE: this is BGR form, be careful for the later cropping process for ID Reference
312
+ print("first_frame_img shape is ", first_frame_img.shape)
313
+
314
 
315
  # Resize to a uniform resolution
316
  first_frame_img = cv2.resize(first_frame_img, (resized_width, resized_height), interpolation = cv2.INTER_AREA)
317
+ print("first_frame_img is resized to", first_frame_img.shape)
318
+
319
 
320
  # Expand to Outside Region to form the Canvas
321
  expand_height = resized_height + top_left_height + bottom_right_height
322
  expand_width = resized_width + top_left_width + bottom_right_width
323
  inference_canvas = np.uint8(np.zeros((expand_height, expand_width, 3))) # Whole Black Canvas, same as other inference
324
  visual_canvas = np.full((expand_height, expand_width, 3), canvas_color, dtype=np.uint8)
325
+ print("Visual Canvas is", visual_canvas.shape)
326
 
327
 
328
  # Sanity Check
 
341
 
342
  # Resize to the uniform height and width
343
  visual_canvas = cv2.resize(visual_canvas, (uniform_width, uniform_height), interpolation = cv2.INTER_AREA)
344
+ print("Visual Canvas resized to", visual_canvas.shape)
345
 
346
 
347
  # Return the visual_canvas (for visualizaiton) and canvas map
 
518
 
519
 
520
 
521
+ @spaces.GPU(duration=400)
522
  def inference(inference_canvas, visual_canvas, text_prompt, traj_lists, main_reference_img,
523
  resized_height, resized_width, top_left_height, top_left_width, bottom_right_height, bottom_right_width):
524