Spaces:
Sleeping
Sleeping
Krishs21 commited on
Commit ·
02fa7db
1
Parent(s): 2a72f29
updated app.py
Browse files
app.py
CHANGED
|
@@ -13,21 +13,16 @@ def predict_auction_price(matches, ipl_runs, strike_rate, average, budget, team_
|
|
| 13 |
team_spin_bowling_allrounder, team_wk, team_away_player, age,
|
| 14 |
is_away, player_type, wickets, economy, is_fast_bowler, bowl_strike_rate):
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
column_names = [
|
| 18 |
-
'matches', 'ipl_runs', 'strike_rate', 'average', 'budget', 'team_batsman',
|
| 19 |
-
'team_fast_bowler', 'team_spin_bowler', 'team_fast_bowling_allrounder',
|
| 20 |
-
'team_spin_bowling_allrounder', 'team_wk', 'team_away_player', 'age', 'is_away',
|
| 21 |
-
'player_type', 'wickets', 'economy', 'is_fast_bowler', 'bowl_strike_rate'
|
| 22 |
-
]
|
| 23 |
-
|
| 24 |
-
# Create a pandas DataFrame with the input features, ensuring the order matches the model's expected input
|
| 25 |
input_data = pd.DataFrame([[matches, ipl_runs, strike_rate, average, budget, team_batsman,
|
| 26 |
team_fast_bowler, team_spin_bowler, team_fast_bowling_allrounder,
|
| 27 |
team_spin_bowling_allrounder, team_wk, team_away_player, age, is_away,
|
| 28 |
player_type, wickets, economy, is_fast_bowler, bowl_strike_rate]],
|
| 29 |
-
columns=
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
# Convert to DMatrix for XGBoost
|
| 32 |
dmatrix = xgb.DMatrix(input_data)
|
| 33 |
|
|
@@ -65,5 +60,3 @@ interface = gr.Interface(
|
|
| 65 |
|
| 66 |
# Launch the Gradio interface
|
| 67 |
interface.launch()
|
| 68 |
-
|
| 69 |
-
|
|
|
|
| 13 |
team_spin_bowling_allrounder, team_wk, team_away_player, age,
|
| 14 |
is_away, player_type, wickets, economy, is_fast_bowler, bowl_strike_rate):
|
| 15 |
|
| 16 |
+
# Create a DataFrame with the correct column names (matching model's training data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
input_data = pd.DataFrame([[matches, ipl_runs, strike_rate, average, budget, team_batsman,
|
| 18 |
team_fast_bowler, team_spin_bowler, team_fast_bowling_allrounder,
|
| 19 |
team_spin_bowling_allrounder, team_wk, team_away_player, age, is_away,
|
| 20 |
player_type, wickets, economy, is_fast_bowler, bowl_strike_rate]],
|
| 21 |
+
columns=['matches', 'ipl_runs', 'strike_rate', 'average', 'budget', 'team_batsman',
|
| 22 |
+
'team_fast_bowler', 'team_spin_bowler', 'team_fast_bowling_allrounder',
|
| 23 |
+
'team_spin_bowling_allrounder', 'team_wk', 'team_away_player', 'age',
|
| 24 |
+
'is_away', 'player_type', 'wickets', 'economy', 'is_fast_bowler', 'bowl_strike_rate'])
|
| 25 |
+
|
| 26 |
# Convert to DMatrix for XGBoost
|
| 27 |
dmatrix = xgb.DMatrix(input_data)
|
| 28 |
|
|
|
|
| 60 |
|
| 61 |
# Launch the Gradio interface
|
| 62 |
interface.launch()
|
|
|
|
|
|