Khalida1w commited on
Commit
cd3b30d
1 Parent(s): 109115f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -46,8 +46,13 @@ def process_video(video_path, output_option):
46
  if not matched_mp4_files:
47
  raise Exception(f"No .mp4 video files found in directory {output_dir} after conversion for {video_name}.")
48
 
49
- # Count the number of objects detected
50
- object_count = len(results.pandas().xyxy[0])
 
 
 
 
 
51
 
52
  # Determine the output based on user's choice
53
  if output_option == "Count":
 
46
  if not matched_mp4_files:
47
  raise Exception(f"No .mp4 video files found in directory {output_dir} after conversion for {video_name}.")
48
 
49
+ # Initialize object count
50
+ object_count = 0
51
+
52
+ # Calculate object count based on results
53
+ for result in results:
54
+ if hasattr(result, 'boxes'):
55
+ object_count += len(result.boxes)
56
 
57
  # Determine the output based on user's choice
58
  if output_option == "Count":