aether-raider commited on
Commit
38e829d
·
1 Parent(s): 653a3eb

fix: ab data saving

Browse files
backend/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/__init__.cpython-311.pyc and b/backend/__pycache__/__init__.cpython-311.pyc differ
 
backend/__pycache__/config.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/config.cpython-311.pyc and b/backend/__pycache__/config.cpython-311.pyc differ
 
backend/__pycache__/data_manager.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/data_manager.cpython-311.pyc and b/backend/__pycache__/data_manager.cpython-311.pyc differ
 
backend/__pycache__/hf_logging.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/hf_logging.cpython-311.pyc and b/backend/__pycache__/hf_logging.cpython-311.pyc differ
 
backend/__pycache__/models.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/models.cpython-311.pyc and b/backend/__pycache__/models.cpython-311.pyc differ
 
backend/__pycache__/session_manager.cpython-311.pyc CHANGED
Binary files a/backend/__pycache__/session_manager.cpython-311.pyc and b/backend/__pycache__/session_manager.cpython-311.pyc differ
 
backend/session_manager.py CHANGED
@@ -283,8 +283,6 @@ class SessionManager:
283
  return
284
 
285
  try:
286
- # Get all AB pairs that were presented to the user from the submitted data
287
- # The comparison data will tell us which type based on the IDs
288
  print(f"[DEBUG] Received ratings for {len(comparisons_data)} comparisons")
289
 
290
  # Build a set of already saved comparison IDs to avoid duplicates
@@ -299,25 +297,41 @@ class SessionManager:
299
  }
300
  print(f"[DEBUG] Already have {len(existing_pairs)} AB comparisons saved for this session")
301
 
302
- # Process each comparison from the submitted data
303
- for comp_id, comparison in comparisons_data.items():
304
- clip_a_id = comparison.get("clip_a_id")
305
- clip_b_id = comparison.get("clip_b_id")
306
-
307
- if not clip_a_id or not clip_b_id:
308
- print(f"[WARN] Skipping comparison {comp_id} - missing clip IDs")
309
- continue
 
 
 
 
 
 
 
 
 
 
 
 
310
 
311
  # Skip if we've already saved this pair
312
  if (clip_a_id, clip_b_id) in existing_pairs:
313
  print(f"[DEBUG] Skipping duplicate comparison: {clip_a_id} vs {clip_b_id}")
314
  continue
315
 
 
 
 
 
316
  ab_response = {
317
  "session_id": session_id,
318
  "clip_a_id": clip_a_id,
319
  "clip_b_id": clip_b_id,
320
- "comparison_type": comparison.get("comparison_type"),
321
  "choice": comparison.get("choice"), # Can be None if not rated
322
  "comment": comparison.get("comment", ""),
323
  # Support both model_vs_model (gender_mismatch_a/b)
 
283
  return
284
 
285
  try:
 
 
286
  print(f"[DEBUG] Received ratings for {len(comparisons_data)} comparisons")
287
 
288
  # Build a set of already saved comparison IDs to avoid duplicates
 
297
  }
298
  print(f"[DEBUG] Already have {len(existing_pairs)} AB comparisons saved for this session")
299
 
300
+ # Determine which pairs we're processing based on comparison_type in the data
301
+ # Check first comparison to see if this is model or gender
302
+ first_comparison = next(iter(comparisons_data.values()), {}) if comparisons_data else {}
303
+ comparison_type = first_comparison.get("comparison_type", "")
304
+
305
+ # Get the appropriate pairs from session
306
+ if comparison_type == "model_vs_model":
307
+ presented_pairs = session.get("ab_model_pairs", [])
308
+ print(f"[DEBUG] Processing model-vs-model pairs: {len(presented_pairs)} pairs presented")
309
+ elif comparison_type == "gender_vs_gender":
310
+ presented_pairs = session.get("ab_gender_pairs", [])
311
+ print(f"[DEBUG] Processing gender-vs-gender pairs: {len(presented_pairs)} pairs presented")
312
+ else:
313
+ print(f"[WARN] Unknown comparison type: {comparison_type}")
314
+ presented_pairs = []
315
+
316
+ # Process all presented pairs
317
+ for clip_a, clip_b in presented_pairs:
318
+ clip_a_id = clip_a.id
319
+ clip_b_id = clip_b.id
320
 
321
  # Skip if we've already saved this pair
322
  if (clip_a_id, clip_b_id) in existing_pairs:
323
  print(f"[DEBUG] Skipping duplicate comparison: {clip_a_id} vs {clip_b_id}")
324
  continue
325
 
326
+ # Get user's rating for this pair from the submitted data
327
+ comp_id = f"{clip_a_id}_vs_{clip_b_id}"
328
+ comparison = comparisons_data.get(comp_id, {})
329
+
330
  ab_response = {
331
  "session_id": session_id,
332
  "clip_a_id": clip_a_id,
333
  "clip_b_id": clip_b_id,
334
+ "comparison_type": comparison_type,
335
  "choice": comparison.get("choice"), # Can be None if not rated
336
  "comment": comparison.get("comment", ""),
337
  # Support both model_vs_model (gender_mismatch_a/b)
frontend/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/frontend/__pycache__/__init__.cpython-311.pyc and b/frontend/__pycache__/__init__.cpython-311.pyc differ
 
frontend/__pycache__/css.cpython-311.pyc CHANGED
Binary files a/frontend/__pycache__/css.cpython-311.pyc and b/frontend/__pycache__/css.cpython-311.pyc differ
 
frontend/pages/__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/__init__.cpython-311.pyc and b/frontend/pages/__pycache__/__init__.cpython-311.pyc differ
 
frontend/pages/__pycache__/ab_gender.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/ab_gender.cpython-311.pyc and b/frontend/pages/__pycache__/ab_gender.cpython-311.pyc differ
 
frontend/pages/__pycache__/ab_model.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/ab_model.cpython-311.pyc and b/frontend/pages/__pycache__/ab_model.cpython-311.pyc differ
 
frontend/pages/__pycache__/conclusion.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/conclusion.cpython-311.pyc and b/frontend/pages/__pycache__/conclusion.cpython-311.pyc differ
 
frontend/pages/__pycache__/intro.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/intro.cpython-311.pyc and b/frontend/pages/__pycache__/intro.cpython-311.pyc differ
 
frontend/pages/__pycache__/mos.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/mos.cpython-311.pyc and b/frontend/pages/__pycache__/mos.cpython-311.pyc differ
 
frontend/pages/__pycache__/samples.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/samples.cpython-311.pyc and b/frontend/pages/__pycache__/samples.cpython-311.pyc differ
 
frontend/pages/__pycache__/thank_you.cpython-311.pyc CHANGED
Binary files a/frontend/pages/__pycache__/thank_you.cpython-311.pyc and b/frontend/pages/__pycache__/thank_you.cpython-311.pyc differ
 
frontend/utils/__pycache__/js_collectors.cpython-311.pyc CHANGED
Binary files a/frontend/utils/__pycache__/js_collectors.cpython-311.pyc and b/frontend/utils/__pycache__/js_collectors.cpython-311.pyc differ
 
frontend/utils/__pycache__/validation.cpython-311.pyc CHANGED
Binary files a/frontend/utils/__pycache__/validation.cpython-311.pyc and b/frontend/utils/__pycache__/validation.cpython-311.pyc differ