Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
|
@@ -27,15 +27,13 @@ def inference(review):
|
|
| 27 |
|
| 28 |
app = FastAPI()
|
| 29 |
@app.post("/classify")
|
| 30 |
-
async def classify(
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
else:
|
| 41 |
-
return {"error": "No image provided"}
|
|
|
|
| 27 |
|
| 28 |
app = FastAPI()
|
| 29 |
@app.post("/classify")
|
| 30 |
+
async def classify(request: ReviewRequest):
|
| 31 |
+
reviews = request.reviews
|
| 32 |
+
predictions = []
|
| 33 |
+
|
| 34 |
+
# Process each review and get the predictions
|
| 35 |
+
for review in reviews:
|
| 36 |
+
predicted_class = inference(review)
|
| 37 |
+
predictions.append({predicted_class})
|
| 38 |
+
|
| 39 |
+
return {"predictions": predictions}
|
|
|
|
|
|