mohith96 commited on
Commit
3e79ee6
·
verified ·
1 Parent(s): d4b909c

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -28
app.py DELETED
@@ -1,28 +0,0 @@
1
- from flask import Flask, request, jsonify
2
- import pandas as pd
3
- import joblib
4
-
5
- # Load model
6
- model = joblib.load("random_forest_pipeline.pkl")
7
- # Create Flask app
8
- app = Flask(__name__)
9
-
10
- # Route: Home
11
- @app.route('/')
12
- def home():
13
- return "Hello! Welcome to SuperKart. I'm here to help you predict your sales for a paticular product"
14
-
15
- # Route: Predict
16
- @app.route('/predict', methods=['POST'])
17
- def predict():
18
- try:
19
- data = request.get_json()
20
- df = pd.DataFrame([data])
21
- prediction = model.predict(df)[0]
22
- return jsonify({'Predicted_Sales for the given product': round(prediction, 2)})
23
- except Exception as e:
24
- return jsonify({'error': str(e)})
25
-
26
- # Run the app
27
- if __name__ == '__main__':
28
- app.run(host='0.0.0.0', port=7860)