Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import joblib
|
| 2 |
import pandas as pd
|
| 3 |
from flask import Flask, request, jsonify
|
|
|
|
| 4 |
|
| 5 |
# Initialize Flask app with a name
|
| 6 |
app = Flask("SuperKart sales prediction app backend")
|
|
@@ -15,7 +16,7 @@ def home():
|
|
| 15 |
|
| 16 |
# Define an endpoint to predict sales of the single product in a store
|
| 17 |
@app.post('/v1/sales')
|
| 18 |
-
def
|
| 19 |
# Get JSON data from the request
|
| 20 |
store_data = request.get_json()
|
| 21 |
|
|
@@ -50,7 +51,7 @@ def predict_churn():
|
|
| 50 |
);
|
| 51 |
|
| 52 |
|
| 53 |
-
# Make a
|
| 54 |
prediction = model.predict(encoded_new_data).tolist()[0]
|
| 55 |
|
| 56 |
#Calculate the actual price
|
|
|
|
| 1 |
import joblib
|
| 2 |
import pandas as pd
|
| 3 |
from flask import Flask, request, jsonify
|
| 4 |
+
import numpy as np
|
| 5 |
|
| 6 |
# Initialize Flask app with a name
|
| 7 |
app = Flask("SuperKart sales prediction app backend")
|
|
|
|
| 16 |
|
| 17 |
# Define an endpoint to predict sales of the single product in a store
|
| 18 |
@app.post('/v1/sales')
|
| 19 |
+
def predict_sales():
|
| 20 |
# Get JSON data from the request
|
| 21 |
store_data = request.get_json()
|
| 22 |
|
|
|
|
| 51 |
);
|
| 52 |
|
| 53 |
|
| 54 |
+
# Make a Sales prediction using the trained model
|
| 55 |
prediction = model.predict(encoded_new_data).tolist()[0]
|
| 56 |
|
| 57 |
#Calculate the actual price
|