Muhammad Taqi Raza commited on
Commit
c920a94
·
1 Parent(s): bd39eaa

resolution

Browse files
Files changed (2) hide show
  1. gradio_app.py +5 -2
  2. inference/v2v_data/demo.py +2 -2
gradio_app.py CHANGED
@@ -131,8 +131,11 @@ def inference(
131
  "--controlnet_input_channels", str(controlnet_input_channels),
132
  "--controlnet_transformer_num_layers", str(controlnet_transformer_num_layers)
133
  ]
134
-
135
- result = subprocess.run(command, capture_output=True, text=True)
 
 
 
136
  logs = result.stdout
137
  video_output = f"{out_dir}/00000_{seed}_out.mp4"
138
  return video_output if os.path.exists(video_output) else None, logs
 
131
  "--controlnet_input_channels", str(controlnet_input_channels),
132
  "--controlnet_transformer_num_layers", str(controlnet_transformer_num_layers)
133
  ]
134
+ try:
135
+ result = subprocess.run(command, capture_output=True, text=True)
136
+ except subprocess.CalledProcessError as e:
137
+ logs = f"❌ Inference failed:\n{e.stderr}{e.stdout}"
138
+ return None, logs
139
  logs = result.stdout
140
  video_output = f"{out_dir}/00000_{seed}_out.mp4"
141
  return video_output if os.path.exists(video_output) else None, logs
inference/v2v_data/demo.py CHANGED
@@ -111,7 +111,7 @@ class GetAnchorVideos:
111
 
112
  def infer_gradual(self, opts):
113
  frames = read_video_frames(
114
- opts.video_path, opts.video_length, opts.stride, opts.max_res, opts.height, opts.width
115
  )
116
  vr = VideoReader(opts.video_path, ctx=cpu(0))
117
  frame_shape = vr[0].shape # (H, W, 3)
@@ -177,7 +177,7 @@ class GetAnchorVideos:
177
  os.makedirs(f'{opts.out_dir}/intrinsics', exist_ok=True)
178
  os.makedirs(f'{opts.out_dir}/captions', exist_ok=True)
179
 
180
- mask_save = process_mask_tensor(torch.cat(masks)).squeeze().cpu().numpy()
181
  np.save(f"{opts.out_dir}/depth/{save_name}.npy",depths.cpu().numpy())
182
  np.savez_compressed(f"{opts.out_dir}/masks/{save_name}.npz",mask=mask_save)
183
  save_video_as_mp4(ori_video_save,f"{opts.out_dir}/videos/{save_name}.mp4", fps=opts.fps)
 
111
 
112
  def infer_gradual(self, opts):
113
  frames = read_video_frames(
114
+ opts.video_path, opts.video_length, opts.stride, opts.max_res, height = opts.height, width = opts.width
115
  )
116
  vr = VideoReader(opts.video_path, ctx=cpu(0))
117
  frame_shape = vr[0].shape # (H, W, 3)
 
177
  os.makedirs(f'{opts.out_dir}/intrinsics', exist_ok=True)
178
  os.makedirs(f'{opts.out_dir}/captions', exist_ok=True)
179
 
180
+ mask_save = process_mask_tensor(torch.cat(masks), resolution=(opts.height, opts.width)).squeeze().cpu().numpy()
181
  np.save(f"{opts.out_dir}/depth/{save_name}.npy",depths.cpu().numpy())
182
  np.savez_compressed(f"{opts.out_dir}/masks/{save_name}.npz",mask=mask_save)
183
  save_video_as_mp4(ori_video_save,f"{opts.out_dir}/videos/{save_name}.mp4", fps=opts.fps)