Update app.py
Browse files
app.py
CHANGED
|
@@ -37,27 +37,25 @@ with st.form("prediction_form"):
|
|
| 37 |
submitted = st.form_submit_button("Predict")
|
| 38 |
|
| 39 |
if submitted:
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
st.error('
|
| 62 |
-
except ValueError as e:
|
| 63 |
-
st.error(f'Error making prediction: {e}')
|
|
|
|
| 37 |
submitted = st.form_submit_button("Predict")
|
| 38 |
|
| 39 |
if submitted:
|
| 40 |
+
# Create the DataFrame without considering the index as a feature
|
| 41 |
+
input_df = pd.DataFrame([[
|
| 42 |
+
gp, min, pts, fgm, fga, fg_percent, threep_made, threepa, threep_percent,
|
| 43 |
+
ftm, fta, ft_percent, oreb, dreb, reb, ast, stl, blk, tov
|
| 44 |
+
]], columns=[
|
| 45 |
+
'GP', 'MIN', 'PTS', 'FGM', 'FGA', 'FG%', '3P Made', '3PA', '3P%',
|
| 46 |
+
'FTM', 'FTA', 'FT%', 'OREB', 'DREB', 'REB', 'AST', 'STL', 'BLK', 'TOV'
|
| 47 |
+
])
|
| 48 |
+
|
| 49 |
+
# Ensure there's no unexpected index that could be interpreted as a feature
|
| 50 |
+
input_df.reset_index(drop=True, inplace=True)
|
| 51 |
+
|
| 52 |
+
# Attempt prediction
|
| 53 |
+
try:
|
| 54 |
+
prediction = model.predict(input_df)[0]
|
| 55 |
+
|
| 56 |
+
if prediction == 1:
|
| 57 |
+
st.success('The rookie is likely to have a successful career spanning at least 5 years!')
|
| 58 |
+
else:
|
| 59 |
+
st.error('The rookie might not have a very successful career lasting at least 5 years.')
|
| 60 |
+
except ValueError as e:
|
| 61 |
+
st.error(f'Error making prediction: {e}')
|
|
|
|
|
|