Og2 commited on
Commit
b5a1e96
·
verified ·
1 Parent(s): 7a2e9c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -340,9 +340,12 @@ def predict_video(video):
340
 
341
  return results
342
 
 
 
 
 
343
  def ComputeStatistics(df):
344
  # Calculer les statistiques supplémentaires
345
- goalScore1 = df['top1'].str.startswith("Goal_1").sum()
346
  goalConceeded = df['top1'].str.startswith("Goal_2").sum()
347
  totalShots1 = df['top1'].str.startswith("Shot_1").sum()
348
  goal1_1 = df['top1'].str.startswith("Goal_1-3").sum()
@@ -368,12 +371,19 @@ def ComputeStatistics(df):
368
  first_goal1_row = df[df['top1'].str.startswith("Goal_1")].iloc[0] if not df[df['top1'].str.startswith("Goal_1")].empty else None
369
  timeFirstGoal1 = (1 / 30) * first_goal1_row['start_frame'] if first_goal1_row is not None else None
370
 
 
 
 
 
371
  # Calculer le taux de conversion
372
- convertionRate1 = goalScore1 / totalShots1 if totalShots1 > 0 else 0
 
 
 
 
373
 
374
  # Créer un dictionnaire pour les statistiques
375
  statistics = {
376
- "goalScore1": goalScore1,
377
  "goalConceeded": goalConceeded,
378
  "totalShots1": totalShots1,
379
  "goal1_1": goal1_1,
@@ -381,6 +391,7 @@ def ComputeStatistics(df):
381
  "goal1_5": goal1_5,
382
  "save1": save1,
383
  "timeFirstGoal1": timeFirstGoal1,
 
384
  "convertionRate1": convertionRate1,
385
  "totalShots2": totalShots2,
386
  "totalGoal2": totalGoal2,
@@ -389,7 +400,9 @@ def ComputeStatistics(df):
389
  "totalBlock2": totalBlock2,
390
  "vistory": vistory,
391
  "saveRate1": saveRate1,
392
- "saveRate2": saveRate2
 
 
393
  }
394
 
395
  # Convertir les valeurs non compatibles en types natifs avant la sérialisation
 
340
 
341
  return results
342
 
343
+ import json
344
+ import numpy as np
345
+ import pandas as pd
346
+
347
  def ComputeStatistics(df):
348
  # Calculer les statistiques supplémentaires
 
349
  goalConceeded = df['top1'].str.startswith("Goal_2").sum()
350
  totalShots1 = df['top1'].str.startswith("Shot_1").sum()
351
  goal1_1 = df['top1'].str.startswith("Goal_1-3").sum()
 
371
  first_goal1_row = df[df['top1'].str.startswith("Goal_1")].iloc[0] if not df[df['top1'].str.startswith("Goal_1")].empty else None
372
  timeFirstGoal1 = (1 / 30) * first_goal1_row['start_frame'] if first_goal1_row is not None else None
373
 
374
+ # Calculer le temps du premier Goal_2
375
+ first_goal2_row = df[df['top1'].str.startswith("Goal_2")].iloc[0] if not df[df['top1'].str.startswith("Goal_2")].empty else None
376
+ timeFirstGoal2 = (1 / 30) * first_goal2_row['start_frame'] if first_goal2_row is not None else None
377
+
378
  # Calculer le taux de conversion
379
+ convertionRate1 = totalGoal1 / totalShots1 if totalShots1 > 0 else 0
380
+
381
+ # Statistiques Clean Sheet
382
+ cleanSheet1 = 1 if totalGoal2 > 0 else 0
383
+ cleanSheet2 = 1 if totalGoal1 > 0 else 0
384
 
385
  # Créer un dictionnaire pour les statistiques
386
  statistics = {
 
387
  "goalConceeded": goalConceeded,
388
  "totalShots1": totalShots1,
389
  "goal1_1": goal1_1,
 
391
  "goal1_5": goal1_5,
392
  "save1": save1,
393
  "timeFirstGoal1": timeFirstGoal1,
394
+ "timeFirstGoal2": timeFirstGoal2,
395
  "convertionRate1": convertionRate1,
396
  "totalShots2": totalShots2,
397
  "totalGoal2": totalGoal2,
 
400
  "totalBlock2": totalBlock2,
401
  "vistory": vistory,
402
  "saveRate1": saveRate1,
403
+ "saveRate2": saveRate2,
404
+ "cleanSheet1": cleanSheet1,
405
+ "cleanSheet2": cleanSheet2
406
  }
407
 
408
  # Convertir les valeurs non compatibles en types natifs avant la sérialisation