ziv-conntour commited on
Commit
ea3825e
·
verified ·
1 Parent(s): cd0b1ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -174,10 +174,7 @@ def check_condition(prompt, base64Frames):
174
 
175
 
176
  # Function to process video clip and update the chatbot
177
- def process_clip(prompt, frames, chatbot, id):
178
- print("prompt", prompt)
179
- print("frames", frames)
180
-
181
  # Print current time in Israel
182
  israel_tz = pytz.timezone('Asia/Jerusalem')
183
  start_time = datetime.now(israel_tz).strftime('%H:%M:%S')
@@ -293,29 +290,32 @@ def analyze_stream(prompt, chatbot):
293
  print("Local file detected. Attempting direct frame seek...")
294
 
295
  # Attempt to seek
296
- success = cap.set(cv2.CAP_PROP_POS_FRAMES, start_frame)
 
 
 
297
 
298
  # Check if seeking was actually successful by reading a frame
299
  ret, test_frame = cap.read()
300
 
301
- if not success or not ret:
302
- # If seeking failed, fall back to manual skipping
303
- print(f"Direct seek to frame {start_frame} failed. Falling back to manual skipping.")
304
- # Reset capture to start
305
- cap.release()
306
- cap = cv2.VideoCapture(stream)
307
- # Skip frames manually
308
- for _ in range(start_frame):
309
- ret, _ = cap.read()
310
- if not ret:
311
- print("Failed before reaching start_frame (manual skip).")
312
- break
313
- # We'll use 'test_frame' from the final read below
314
- ret, test_frame = cap.read()
315
 
316
  frames = []
317
  start_time = time.time()
318
- clip_id = 0
319
 
320
  print("Starting capture from the current position now.")
321
  if ret and test_frame is not None:
 
174
 
175
 
176
  # Function to process video clip and update the chatbot
177
+ def process_clip(prompt, frames, chatbot, id):
 
 
 
178
  # Print current time in Israel
179
  israel_tz = pytz.timezone('Asia/Jerusalem')
180
  start_time = datetime.now(israel_tz).strftime('%H:%M:%S')
 
290
  print("Local file detected. Attempting direct frame seek...")
291
 
292
  # Attempt to seek
293
+ # success = cap.set(cv2.CAP_PROP_POS_FRAMES, start_frame)
294
+
295
+ for _ in range(start_frame):
296
+ ret, _ = cap.read()
297
 
298
  # Check if seeking was actually successful by reading a frame
299
  ret, test_frame = cap.read()
300
 
301
+ # if not success or not ret:
302
+ # # If seeking failed, fall back to manual skipping
303
+ # print(f"Direct seek to frame {start_frame} failed. Falling back to manual skipping.")
304
+ # # Reset capture to start
305
+ # cap.release()
306
+ # cap = cv2.VideoCapture(stream)
307
+ # # Skip frames manually
308
+ # for _ in range(start_frame):
309
+ # ret, _ = cap.read()
310
+ # if not ret:
311
+ # print("Failed before reaching start_frame (manual skip).")
312
+ # break
313
+ # # We'll use 'test_frame' from the final read below
314
+ # ret, test_frame = cap.read()
315
 
316
  frames = []
317
  start_time = time.time()
318
+ clip_id = start_time
319
 
320
  print("Starting capture from the current position now.")
321
  if ret and test_frame is not None: