vtdung23 commited on
Commit
59e37d1
·
verified ·
1 Parent(s): 4bc008b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app/routers/prediction.py +3 -1
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=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'],