Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -25,15 +25,12 @@ def home():
|
|
| 25 |
def predict_sales():
|
| 26 |
"""
|
| 27 |
This function handles POST requests to the '/v1/predict' endpoint.
|
| 28 |
-
It expects a JSON payload containing
|
| 29 |
the predicted lead's outcome status as a JSON response.
|
| 30 |
"""
|
| 31 |
# Get the JSON data from the request body
|
| 32 |
lead_data = request.get_json()
|
| 33 |
|
| 34 |
-
print("Received payload:", lead_data)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
# Extract relevant lead features from the input data
|
| 38 |
sample = {
|
| 39 |
'age': lead_data['age'],
|
|
@@ -59,8 +56,7 @@ def predict_sales():
|
|
| 59 |
|
| 60 |
# Return the prediction as a JSON response
|
| 61 |
return jsonify({'Status': int(prediction)})
|
| 62 |
-
|
| 63 |
-
|
| 64 |
|
| 65 |
# Run the Flask app in debug mode if this script is executed directly
|
| 66 |
if __name__ == '__main__':
|
|
|
|
| 25 |
def predict_sales():
|
| 26 |
"""
|
| 27 |
This function handles POST requests to the '/v1/predict' endpoint.
|
| 28 |
+
It expects a JSON payload containing lead details and returns
|
| 29 |
the predicted lead's outcome status as a JSON response.
|
| 30 |
"""
|
| 31 |
# Get the JSON data from the request body
|
| 32 |
lead_data = request.get_json()
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
# Extract relevant lead features from the input data
|
| 35 |
sample = {
|
| 36 |
'age': lead_data['age'],
|
|
|
|
| 56 |
|
| 57 |
# Return the prediction as a JSON response
|
| 58 |
return jsonify({'Status': int(prediction)})
|
| 59 |
+
|
|
|
|
| 60 |
|
| 61 |
# Run the Flask app in debug mode if this script is executed directly
|
| 62 |
if __name__ == '__main__':
|