luulinh90s commited on
Commit
4376446
·
1 Parent(s): b5cdbb3
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -236,27 +236,31 @@ def experiment(username):
236
  return redirect(url_for('completed', username=username))
237
 
238
  sample = selected_samples[current_index]
 
 
239
  method_a, method_b = methods
240
 
241
  # Find matching files for both methods
242
- file_a = None
243
- file_b = None
244
 
245
  method_a_dir = get_method_dir(method_a)
246
  method_b_dir = get_method_dir(method_b)
247
 
248
- for category in ['TP', 'TN', 'FP', 'FN']:
249
- dir_a = f'htmls_{method_a_dir.upper()}/{category}'
250
- dir_b = f'htmls_{method_b_dir.upper()}/{category}'
251
-
252
- files_a = os.listdir(dir_a)
253
- files_b = os.listdir(dir_b)
254
-
255
- matching_files = set(files_a) & set(files_b)
256
- if matching_files:
257
- file_a = os.path.join(dir_a, next(iter(matching_files)))
258
- file_b = os.path.join(dir_b, next(iter(matching_files)))
259
- break
 
 
 
 
260
 
261
  if not file_a or not file_b:
262
  logger.error(f"Missing files for comparison at index {current_index}")
 
236
  return redirect(url_for('completed', username=username))
237
 
238
  sample = selected_samples[current_index]
239
+ logger.info(f"sample:\n{sample}")
240
+
241
  method_a, method_b = methods
242
 
243
  # Find matching files for both methods
 
 
244
 
245
  method_a_dir = get_method_dir(method_a)
246
  method_b_dir = get_method_dir(method_b)
247
 
248
+ # for category in ['TP', 'TN', 'FP', 'FN']:
249
+ category = sample['category']
250
+ dir_a = f'htmls_{method_a_dir.upper()}/{category}'
251
+ dir_b = f'htmls_{method_b_dir.upper()}/{category}'
252
+
253
+ file_a = os.path.join(dir_a, sample['file'])
254
+ file_b = os.path.join(dir_b, sample['file'])
255
+
256
+ # files_a = os.listdir(dir_a)
257
+ # files_b = os.listdir(dir_b)
258
+ #
259
+ # matching_files = set(files_a) & set(files_b)
260
+ # if matching_files:
261
+ # file_a = os.path.join(dir_a, next(iter(matching_files)))
262
+ # file_b = os.path.join(dir_b, next(iter(matching_files)))
263
+ # break
264
 
265
  if not file_a or not file_b:
266
  logger.error(f"Missing files for comparison at index {current_index}")