ghostsInTheMachine
commited on
Commit
•
0a17f2b
1
Parent(s):
3e8f9ec
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,8 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
22 |
task_name = 'depth'
|
23 |
pipe_g, pipe_d = load_models(task_name, device)
|
24 |
|
25 |
-
# Preprocess the video to adjust
|
26 |
-
def preprocess_video(video_path, target_fps=24
|
27 |
"""Preprocess the video to adjust its frame rate."""
|
28 |
video = mp.VideoFileClip(video_path)
|
29 |
|
@@ -37,7 +37,7 @@ def preprocess_video(video_path, target_fps=24, max_resolution=None):
|
|
37 |
def resize_and_pad(image, target_size):
|
38 |
"""Resize and pad an image to the target size while preserving aspect ratio."""
|
39 |
# Calculate the new size preserving aspect ratio
|
40 |
-
image.thumbnail(target_size, Image.
|
41 |
|
42 |
# Create a new image with the target size and black background
|
43 |
new_image = Image.new("RGB", target_size)
|
|
|
22 |
task_name = 'depth'
|
23 |
pipe_g, pipe_d = load_models(task_name, device)
|
24 |
|
25 |
+
# Preprocess the video to adjust frame rate
|
26 |
+
def preprocess_video(video_path, target_fps=24):
|
27 |
"""Preprocess the video to adjust its frame rate."""
|
28 |
video = mp.VideoFileClip(video_path)
|
29 |
|
|
|
37 |
def resize_and_pad(image, target_size):
|
38 |
"""Resize and pad an image to the target size while preserving aspect ratio."""
|
39 |
# Calculate the new size preserving aspect ratio
|
40 |
+
image.thumbnail(target_size, Image.LANCZOS)
|
41 |
|
42 |
# Create a new image with the target size and black background
|
43 |
new_image = Image.new("RGB", target_size)
|