Spaces:
Paused
Paused
Muhammad Taqi Raza
commited on
Commit
·
72a0cd6
1
Parent(s):
95687fc
depth issue
Browse files- gradio_app.py +3 -3
gradio_app.py
CHANGED
@@ -35,7 +35,7 @@ def download_models():
|
|
35 |
print("✅ Pretrained models already exist.")
|
36 |
|
37 |
|
38 |
-
def visualize_depth_npy_as_video(npy_file):
|
39 |
# Load .npy file
|
40 |
depth_np = np.load(npy_file.name) # Shape: [T, 1, H, W]
|
41 |
tensor = torch.from_numpy(depth_np)
|
@@ -44,7 +44,7 @@ def visualize_depth_npy_as_video(npy_file):
|
|
44 |
# Prepare video writer
|
45 |
video_path = "depth_video_preview.mp4"
|
46 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
47 |
-
out = cv2.VideoWriter(video_path, fourcc,
|
48 |
|
49 |
for i in range(T):
|
50 |
frame = tensor[i, 0].numpy()
|
@@ -72,7 +72,7 @@ def get_anchor_video(video_path, fps, num_frames, target_pose, mode,
|
|
72 |
video_output_path = f"{output_dir}/masked_videos/output.mp4"
|
73 |
captions_text_file = f"{output_dir}/captions/output.txt"
|
74 |
depth_file = f"{output_dir}/depth/output.npy"
|
75 |
-
depth_video_path =
|
76 |
|
77 |
|
78 |
if video_path:
|
|
|
35 |
print("✅ Pretrained models already exist.")
|
36 |
|
37 |
|
38 |
+
def visualize_depth_npy_as_video(npy_file, fps):
|
39 |
# Load .npy file
|
40 |
depth_np = np.load(npy_file.name) # Shape: [T, 1, H, W]
|
41 |
tensor = torch.from_numpy(depth_np)
|
|
|
44 |
# Prepare video writer
|
45 |
video_path = "depth_video_preview.mp4"
|
46 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
47 |
+
out = cv2.VideoWriter(video_path, fourcc, fps, (W, H)) # 10 FPS
|
48 |
|
49 |
for i in range(T):
|
50 |
frame = tensor[i, 0].numpy()
|
|
|
72 |
video_output_path = f"{output_dir}/masked_videos/output.mp4"
|
73 |
captions_text_file = f"{output_dir}/captions/output.txt"
|
74 |
depth_file = f"{output_dir}/depth/output.npy"
|
75 |
+
depth_video_path = visualize_depth_npy_as_video(depth_file, fps)
|
76 |
|
77 |
|
78 |
if video_path:
|