ziv-conntour commited on
Commit
ed2b9ce
·
verified ·
1 Parent(s): 4e5fd61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -78,7 +78,9 @@ print("base_start_time", base_start_time)
78
  def clip_video_segment_2(input_video_path, start_time, duration):
79
  os.makedirs('videos', exist_ok=True)
80
  output_video_path = f"videos/{uuid.uuid4()}.mp4"
81
-
 
 
82
  # Use ffmpeg-python to clip the video
83
  try:
84
  (
@@ -172,6 +174,9 @@ def check_condition(prompt, base64Frames):
172
 
173
  # Function to process video clip and update the chatbot
174
  def process_clip(prompt, frames, chatbot, id):
 
 
 
175
  # Print current time in Israel
176
  israel_tz = pytz.timezone('Asia/Jerusalem')
177
  start_time = datetime.now(israel_tz).strftime('%H:%M:%S')
@@ -186,6 +191,8 @@ def process_clip(prompt, frames, chatbot, id):
186
  response_details = api_response.get('details', '')
187
  finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
188
  # video_clip_path = encode_to_video_fast(frames, fps)
 
 
189
  video_clip_path = clip_video_segment_2(VIDEO_PATH, id*LENGTH, LENGTH)
190
  chatbot.append(((video_clip_path,), None))
191
  chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {response_details}", None))
@@ -328,6 +335,7 @@ def analyze_stream(prompt, chatbot):
328
  # Sample the frames every LENGTH seconds
329
  if time.time() - start_time >= LENGTH:
330
  # Start a new thread for processing the video clip
 
331
  Thread(target=process_clip, args=(prompt, frames.copy(), chatbot, clip_id)).start()
332
  frames = []
333
  start_time = time.time()
 
78
  def clip_video_segment_2(input_video_path, start_time, duration):
79
  os.makedirs('videos', exist_ok=True)
80
  output_video_path = f"videos/{uuid.uuid4()}.mp4"
81
+
82
+
83
+ print("clip_video_segment_2.start_time", start_time)
84
  # Use ffmpeg-python to clip the video
85
  try:
86
  (
 
174
 
175
  # Function to process video clip and update the chatbot
176
  def process_clip(prompt, frames, chatbot, id):
177
+ print("prompt", prompt)
178
+ print("frames", frames)
179
+
180
  # Print current time in Israel
181
  israel_tz = pytz.timezone('Asia/Jerusalem')
182
  start_time = datetime.now(israel_tz).strftime('%H:%M:%S')
 
191
  response_details = api_response.get('details', '')
192
  finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
193
  # video_clip_path = encode_to_video_fast(frames, fps)
194
+
195
+ print("process_clip id*LENGTH", id*LENGTH)
196
  video_clip_path = clip_video_segment_2(VIDEO_PATH, id*LENGTH, LENGTH)
197
  chatbot.append(((video_clip_path,), None))
198
  chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {response_details}", None))
 
335
  # Sample the frames every LENGTH seconds
336
  if time.time() - start_time >= LENGTH:
337
  # Start a new thread for processing the video clip
338
+ print("analyze_stream.clip_id", clip_id)
339
  Thread(target=process_clip, args=(prompt, frames.copy(), chatbot, clip_id)).start()
340
  frames = []
341
  start_time = time.time()