Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app/routers/prediction.py
CHANGED
|
@@ -117,11 +117,13 @@ async def predict_batch(
|
|
| 117 |
# Make batch predictions
|
| 118 |
predictions = ml_service.predict_batch(comments)
|
| 119 |
|
|
|
|
|
|
|
| 120 |
# Save to history
|
| 121 |
for pred in predictions:
|
| 122 |
history = PredictionHistory(
|
| 123 |
user_id=current_user.id,
|
| 124 |
-
product_name=
|
| 125 |
comment=pred['text'],
|
| 126 |
predicted_rating=pred['rating'],
|
| 127 |
confidence_score=pred['confidence'],
|
|
|
|
| 117 |
# Make batch predictions
|
| 118 |
predictions = ml_service.predict_batch(comments)
|
| 119 |
|
| 120 |
+
final_product_name = product_name if product_name else "Unknown Product"
|
| 121 |
+
|
| 122 |
# Save to history
|
| 123 |
for pred in predictions:
|
| 124 |
history = PredictionHistory(
|
| 125 |
user_id=current_user.id,
|
| 126 |
+
product_name=final_product_name,
|
| 127 |
comment=pred['text'],
|
| 128 |
predicted_rating=pred['rating'],
|
| 129 |
confidence_score=pred['confidence'],
|