ghostsInTheMachine commited on
Commit
3d7224a
1 Parent(s): 284af32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -78,7 +78,7 @@ def preprocess_video(video_path, target_fps=24, max_resolution=(640, 360)):
78
 
79
  return video
80
 
81
- def process_frame(frame, seed=0):
82
  """
83
  Process a single frame through the depth model.
84
  Returns the discriminative depth map.
@@ -113,6 +113,9 @@ def process_video(video_path, fps=0, seed=0, max_workers=2):
113
  """
114
  temp_dir = None
115
  try:
 
 
 
116
  # Preprocess the video
117
  video = preprocess_video(video_path)
118
 
@@ -134,7 +137,7 @@ def process_video(video_path, fps=0, seed=0, max_workers=2):
134
  processed_frames = []
135
  with ThreadPoolExecutor(max_workers=max_workers) as executor:
136
  for i in range(0, total_frames, 10): # Process 10 frames at a time
137
- futures = [executor.submit(process_frame, frames[j], seed) for j in range(i, min(i + 10, total_frames))]
138
  for j, future in enumerate(futures):
139
  try:
140
  result = future.result()
 
78
 
79
  return video
80
 
81
+ def process_frame(frame, seed=0, start_time=None):
82
  """
83
  Process a single frame through the depth model.
84
  Returns the discriminative depth map.
 
113
  """
114
  temp_dir = None
115
  try:
116
+ # Initialize start_time here for use in process_frame
117
+ start_time = time.time()
118
+
119
  # Preprocess the video
120
  video = preprocess_video(video_path)
121
 
 
137
  processed_frames = []
138
  with ThreadPoolExecutor(max_workers=max_workers) as executor:
139
  for i in range(0, total_frames, 10): # Process 10 frames at a time
140
+ futures = [executor.submit(process_frame, frames[j], seed, start_time) for j in range(i, min(i + 10, total_frames))]
141
  for j, future in enumerate(futures):
142
  try:
143
  result = future.result()