SSamson commited on
Commit
22e1a4e
·
verified ·
1 Parent(s): 0bd5dff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -27
app.py CHANGED
@@ -53,33 +53,6 @@ def train_model(df):
53
  # Step 5: Deployment with Flask
54
  app = Flask(__name__)
55
 
56
- @app.route('/predict', methods=['POST'])
57
- def predict():
58
- data = request.json
59
- input_features = [data['RecentForm'], data['HomeAdvantage']]
60
- prediction = model.predict([input_features])[0]
61
- return jsonify({'prediction': prediction})
62
-
63
- if __name__ == '__main__':
64
- # Fetch and preprocess data
65
- df = fetch_data()
66
- df = preprocess_data(df)
67
- df = engineer_features(df)
68
-
69
- # Train the model
70
- model = train_model(df)
71
-
72
- # Run the Flask app
73
- app.run(debug=True, host='0.0.0.0', port=5000)
74
- y_pred = model.predict(X_test)
75
- mae = mean_absolute_error(y_test, y_pred)
76
- print(f"Mean Absolute Error: {mae}")
77
-
78
- return model
79
-
80
- # Step 5: Deployment with Flask
81
- app = Flask(__name__)
82
-
83
  @app.route('/predict', methods=['POST'])
84
  def predict():
85
  data = request.json
 
53
  # Step 5: Deployment with Flask
54
  app = Flask(__name__)
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  @app.route('/predict', methods=['POST'])
57
  def predict():
58
  data = request.json