Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
SuperKart_turnOver_prediction_model_v1_0.joblib
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67bbe0be2e0ed379a927e8c4965c62a871ce679336d7511bd3e7a15536f86172
|
| 3 |
+
size 21131427
|
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from flask import Flask, request, jsonify
|
|
| 5 |
# Initialize Flask app with a name
|
| 6 |
SalesRevenue_predictor_api = Flask("Sales Revenue predictor")
|
| 7 |
|
| 8 |
-
# Load the trained
|
| 9 |
model = joblib.load("SuperKart_turnOver_prediction_model_v1_0.joblib")
|
| 10 |
|
| 11 |
# Define a route for the home page
|
|
@@ -13,7 +13,7 @@ model = joblib.load("SuperKart_turnOver_prediction_model_v1_0.joblib")
|
|
| 13 |
def home():
|
| 14 |
return "Welcome to the Sales Revenue Prediction API!"
|
| 15 |
|
| 16 |
-
# Define an endpoint to predict
|
| 17 |
@SalesRevenue_predictor_api.route('/v1/Sales_prediction', methods=['POST'])
|
| 18 |
def predict_revenue():
|
| 19 |
# Get JSON data from the request
|
|
@@ -41,9 +41,6 @@ def predict_revenue():
|
|
| 41 |
#prediction = model.predict(input_data).tolist()[0]
|
| 42 |
prediction = model.predict(input_data)[0]
|
| 43 |
|
| 44 |
-
# Map prediction result to a human-readable label
|
| 45 |
-
# prediction_label = "churn" if prediction == 1 else "not churn"
|
| 46 |
-
|
| 47 |
# Return the prediction as a JSON response
|
| 48 |
return jsonify({ 'Prediction': prediction, 'Message': 'Prediction completed' })
|
| 49 |
|
|
|
|
| 5 |
# Initialize Flask app with a name
|
| 6 |
SalesRevenue_predictor_api = Flask("Sales Revenue predictor")
|
| 7 |
|
| 8 |
+
# Load the trained revenue prediction model
|
| 9 |
model = joblib.load("SuperKart_turnOver_prediction_model_v1_0.joblib")
|
| 10 |
|
| 11 |
# Define a route for the home page
|
|
|
|
| 13 |
def home():
|
| 14 |
return "Welcome to the Sales Revenue Prediction API!"
|
| 15 |
|
| 16 |
+
# Define an endpoint to predict revenue for a single customer
|
| 17 |
@SalesRevenue_predictor_api.route('/v1/Sales_prediction', methods=['POST'])
|
| 18 |
def predict_revenue():
|
| 19 |
# Get JSON data from the request
|
|
|
|
| 41 |
#prediction = model.predict(input_data).tolist()[0]
|
| 42 |
prediction = model.predict(input_data)[0]
|
| 43 |
|
|
|
|
|
|
|
|
|
|
| 44 |
# Return the prediction as a JSON response
|
| 45 |
return jsonify({ 'Prediction': prediction, 'Message': 'Prediction completed' })
|
| 46 |
|