Irpan commited on
Commit
219eb27
·
1 Parent(s): 3d9e5a0
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -66,7 +66,8 @@ def process_video(input_video):
66
  tracks['players'][frame_num][assigned_player]['has_ball'] = True
67
  team_ball_control.append(tracks['players'][frame_num][assigned_player]['team'])
68
  else:
69
- team_ball_control.append(team_ball_control[-1])
 
70
  team_ball_control = np.array(team_ball_control)
71
 
72
  # Draw output
@@ -88,6 +89,6 @@ interface = gr.Interface(fn=process_video,
88
  outputs=gr.Video(label="Processed Video"),
89
  live=False, # No live update to avoid real-time processing issues
90
  title="Football Match Analytics with YOLO and OpenCV",
91
- description="This tool processes football game videos to track player movements, team assignments, ball possession, speed, distance, and camera movement. Reference: https://www.youtube.com/watch?v=neBZ6huolkg&t=15083s") # Allow users to download the processed video
92
 
93
  interface.launch(debug=True, show_error = True)
 
66
  tracks['players'][frame_num][assigned_player]['has_ball'] = True
67
  team_ball_control.append(tracks['players'][frame_num][assigned_player]['team'])
68
  else:
69
+ if team_ball_control: # in case first few frames assigned_player == -1
70
+ team_ball_control.append(team_ball_control[-1])
71
  team_ball_control = np.array(team_ball_control)
72
 
73
  # Draw output
 
89
  outputs=gr.Video(label="Processed Video"),
90
  live=False, # No live update to avoid real-time processing issues
91
  title="Football Match Analytics with YOLO and OpenCV",
92
+ description="This tool processes football game videos to track player movements, team assignments, ball possession, speed, distance, and camera movement. <br> Original Reference: https://www.youtube.com/watch?v=neBZ6huolkg&t=15083s") # Allow users to download the processed video
93
 
94
  interface.launch(debug=True, show_error = True)