Update app.py
Browse files
app.py
CHANGED
|
@@ -101,6 +101,19 @@ def predict_sales():
|
|
| 101 |
# Handle potential errors during prediction
|
| 102 |
return jsonify({'error': str(e)}), 400
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
# Run the Flask app in debug mode
|
| 106 |
if __name__ == '__main__':
|
|
|
|
| 101 |
# Handle potential errors during prediction
|
| 102 |
return jsonify({'error': str(e)}), 400
|
| 103 |
|
| 104 |
+
# Health & docs endpoint
|
| 105 |
+
@superkart_sales_api.route("/health")
|
| 106 |
+
def health():
|
| 107 |
+
return {"status": "ok"}, 200
|
| 108 |
+
|
| 109 |
+
@superkart_sales_api.route("/endpoints")
|
| 110 |
+
def endpoints():
|
| 111 |
+
return {
|
| 112 |
+
"GET /": "Welcome page",
|
| 113 |
+
"GET /health": "Simple status check",
|
| 114 |
+
"POST /v1/predict": "Send JSON; returns predicted_sales"
|
| 115 |
+
}, 200
|
| 116 |
+
|
| 117 |
|
| 118 |
# Run the Flask app in debug mode
|
| 119 |
if __name__ == '__main__':
|