adi-123 commited on
Commit
d118406
·
verified ·
1 Parent(s): a31d93e

Update app.py

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