Update handler.py
Browse files- handler.py +8 -1
handler.py
CHANGED
|
@@ -27,10 +27,17 @@ class EndpointHandler:
|
|
| 27 |
return "Invalid rating"
|
| 28 |
|
| 29 |
def __call__(self, inputs):
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
predicted_rating = self.predict_rating(review)
|
| 32 |
predicted_description = self.map_rating_to_description(predicted_rating)
|
| 33 |
return {
|
|
|
|
|
|
|
| 34 |
"predicted_rating": int(predicted_rating),
|
| 35 |
"predicted_description": predicted_description
|
| 36 |
}
|
|
|
|
| 27 |
return "Invalid rating"
|
| 28 |
|
| 29 |
def __call__(self, inputs):
|
| 30 |
+
customer_Name = inputs.get("customer_Name", "")
|
| 31 |
+
review = inputs.get("review", "")
|
| 32 |
+
|
| 33 |
+
if not review:
|
| 34 |
+
return {"error": "No review provided"}
|
| 35 |
+
|
| 36 |
predicted_rating = self.predict_rating(review)
|
| 37 |
predicted_description = self.map_rating_to_description(predicted_rating)
|
| 38 |
return {
|
| 39 |
+
"customer_Name": customer_Name,
|
| 40 |
+
"review": review,
|
| 41 |
"predicted_rating": int(predicted_rating),
|
| 42 |
"predicted_description": predicted_description
|
| 43 |
}
|