juanpablomesa commited on
Commit
cec58ea
·
1 Parent(s): e8faf30

Added logging messages

Browse files
Files changed (1) hide show
  1. handler.py +6 -0
handler.py CHANGED
@@ -130,12 +130,16 @@ class EndpointHandler:
130
 
131
  def process_video(self, video_url, video_metadata):
132
  try:
 
133
  video_bytes, video_headers = self.download_video_as_bytes(video_url)
 
134
  frames = self.extract_evenly_spaced_frames_from_bytes(
135
  video_bytes, num_frames=32
136
  )
 
137
  frame_embeddings = self.embed_frames_with_xclip_processing(frames)
138
  video_metadata["url"] = video_url
 
139
  return frame_embeddings, video_metadata
140
  except Exception as e:
141
  print(e)
@@ -204,7 +208,9 @@ class EndpointHandler:
204
  **video_metadata,
205
  }
206
  processed_videos_metadata.append(processed_metadata)
 
207
  # Return the embeddings
 
208
  return {
209
  "embeddings": processed_video_embeddings,
210
  "metadata": processed_videos_metadata,
 
130
 
131
  def process_video(self, video_url, video_metadata):
132
  try:
133
+ self.logger.info("Downloading video as bytes.")
134
  video_bytes, video_headers = self.download_video_as_bytes(video_url)
135
+ self.logger.info("Extracting frames.")
136
  frames = self.extract_evenly_spaced_frames_from_bytes(
137
  video_bytes, num_frames=32
138
  )
139
+ self.logger.info("Embedding frames with Xclip.")
140
  frame_embeddings = self.embed_frames_with_xclip_processing(frames)
141
  video_metadata["url"] = video_url
142
+ self.logger.info("Returning embeddings and metadata.")
143
  return frame_embeddings, video_metadata
144
  except Exception as e:
145
  print(e)
 
208
  **video_metadata,
209
  }
210
  processed_videos_metadata.append(processed_metadata)
211
+ self.logger.info(f"Finished processing batch {i}")
212
  # Return the embeddings
213
+ self.logger.info("Returning embeddings and metadata of all batches")
214
  return {
215
  "embeddings": processed_video_embeddings,
216
  "metadata": processed_videos_metadata,