Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -7,13 +7,8 @@ from flask import Flask, request, jsonify # For creating the Flask API
|
|
| 7 |
# Initialize the Flask application
|
| 8 |
sales_predictor_api = Flask("SuperKart Sales Predictor")
|
| 9 |
|
| 10 |
-
# Load the trained model
|
| 11 |
-
@st.cache_resource
|
| 12 |
-
def load_model():
|
| 13 |
-
return joblib.load("superkart_prediction_model_v1_0.joblib")
|
| 14 |
-
|
| 15 |
# Load the trained machine learning model
|
| 16 |
-
model =
|
| 17 |
|
| 18 |
# Define a route for the home page (GET request)
|
| 19 |
@sales_predictor_api.get('/')
|
|
@@ -73,7 +68,8 @@ def predict_sales_batch():
|
|
| 73 |
"""
|
| 74 |
This function handles POST requests to the '/v1/salesbatch' endpoint.
|
| 75 |
It expects a CSV file containing property details for multiple properties
|
| 76 |
-
and returns
|
|
|
|
| 77 |
"""
|
| 78 |
# Get the uploaded CSV file from the request
|
| 79 |
file = request.files['file']
|
|
|
|
| 7 |
# Initialize the Flask application
|
| 8 |
sales_predictor_api = Flask("SuperKart Sales Predictor")
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Load the trained machine learning model
|
| 11 |
+
model = joblib.load("superkart_prediction_model_v1_0.joblib")
|
| 12 |
|
| 13 |
# Define a route for the home page (GET request)
|
| 14 |
@sales_predictor_api.get('/')
|
|
|
|
| 68 |
"""
|
| 69 |
This function handles POST requests to the '/v1/salesbatch' endpoint.
|
| 70 |
It expects a CSV file containing property details for multiple properties
|
| 71 |
+
and returns
|
| 72 |
+
the predicted rental prices as a dictionary in the JSON response.
|
| 73 |
"""
|
| 74 |
# Get the uploaded CSV file from the request
|
| 75 |
file = request.files['file']
|