Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -6,7 +6,8 @@ from flask import Flask, request, jsonify
|
|
| 6 |
churn_predictor_api = Flask("Customer Churn Predictor")
|
| 7 |
|
| 8 |
# Load the trained churn prediction model
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
# Define a route for the home page
|
| 12 |
@churn_predictor_api.get('/')
|
|
@@ -48,7 +49,8 @@ def predict_churn():
|
|
| 48 |
@churn_predictor_api.post('/v1/customerbatch')
|
| 49 |
def predict_churn_batch():
|
| 50 |
# Get the uploaded CSV file from the request
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
# Read the file into a DataFrame
|
| 54 |
input_data = pd.read_csv(file)
|
|
|
|
| 6 |
churn_predictor_api = Flask("Customer Churn Predictor")
|
| 7 |
|
| 8 |
# Load the trained churn prediction model
|
| 9 |
+
# Correct the path to load the model from the /app directory in the container
|
| 10 |
+
model = joblib.load("/app/churn_prediction_model_v1_0.joblib")
|
| 11 |
|
| 12 |
# Define a route for the home page
|
| 13 |
@churn_predictor_api.get('/')
|
|
|
|
| 49 |
@churn_predictor_api.post('/v1/customerbatch')
|
| 50 |
def predict_churn_batch():
|
| 51 |
# Get the uploaded CSV file from the request
|
| 52 |
+
# Correct the path to read the file directly from the request
|
| 53 |
+
file = request.files['file']
|
| 54 |
|
| 55 |
# Read the file into a DataFrame
|
| 56 |
input_data = pd.read_csv(file)
|