Hugo Lindgren commited on
Commit
57a986f
·
1 Parent(s): d757d64
Files changed (1) hide show
  1. app.py +23 -3
app.py CHANGED
@@ -26,9 +26,6 @@ fg = fs.get_or_create_feature_group(
26
  primary_key=['player_id', 'date'] # Replace with your primary key column name(s)
27
  )
28
 
29
- df = fg.read()
30
- print(df)
31
-
32
  def valuation_predictor(goals, assists, y_cards, r_cards,
33
  m_played, height, age, mo_left,
34
  t_made_goals, t_conceded_goals, t_clean_sheets,
@@ -54,10 +51,33 @@ def valuation_predictor(goals, assists, y_cards, r_cards,
54
  formatted_output_thousand = f"{round(estimated_valuation[0], -3):,} EUR"
55
  return formatted_output_thousand
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
59
  with gr.Row():
60
  gr.Label(value="Latest predictions", show_label=False)
 
61
 
62
 
63
 
 
26
  primary_key=['player_id', 'date'] # Replace with your primary key column name(s)
27
  )
28
 
 
 
 
29
  def valuation_predictor(goals, assists, y_cards, r_cards,
30
  m_played, height, age, mo_left,
31
  t_made_goals, t_conceded_goals, t_clean_sheets,
 
51
  formatted_output_thousand = f"{round(estimated_valuation[0], -3):,} EUR"
52
  return formatted_output_thousand
53
 
54
+ df = fg.read()
55
+ df = df.drop(columns=["player_id", "date"])
56
+ df_present = pd.DataFrame(["Player name", "League", "Goals", "Assists", "Yellow cards", "Red cards", "Minutes played", "Height (cm)", "Age", "Months left on contract", "Team made goals", "Team conceded goals", "Team clean sheets", "Actual market value (EUR)", "Model predicted market value (EUR)"])
57
+
58
+ for row in df:
59
+ league = ""
60
+ if row['league_es1']:
61
+ league == "La Liga"
62
+ elif row['league_fr1']:
63
+ league == "League 1"
64
+ elif row['league_gb1']:
65
+ league == "Premier league"
66
+ elif row['league_it1']:
67
+ league == "Serie A"
68
+ elif row['league_it1']:
69
+ league == "Bundesliga"
70
+
71
+ df_present = df_present.append(
72
+ row["player_name"], league, row["goals"], row["assists"], row["yellow_cards"], row["red_cards"], row["minutes_played"], row["height_in_cm"], row["age"], row["months_left"], row["own_goals"], row["opponent_goals"], row["clean_sheets"], row["market_value_in_eur"], "123123123"
73
+ )
74
+
75
+ predicted_value = valuation_predictor()
76
 
77
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
78
  with gr.Row():
79
  gr.Label(value="Latest predictions", show_label=False)
80
+ gr.DataFrame(value=df_present)
81
 
82
 
83