Mayamaya commited on
Commit
7e31f53
·
1 Parent(s): 80bd4a0

validation

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -287,6 +287,7 @@ def display_current_prompt_and_criterion():
287
  ]
288
 
289
 
 
290
  # ▼▼▼ 修正後の validate_and_navigate 関数 ▼▼▼
291
  def validate_and_navigate():
292
  ranks = GLOBAL_STATE["current_ranks"]
@@ -303,6 +304,18 @@ def validate_and_navigate():
303
  error_msg = "Please provide an absolute score for the BEST matching image (1-7). / 最も一致している画像について、絶対評価(1~7)を選択してください。"
304
  elif is_alignment_criterion and GLOBAL_STATE["current_absolute_score_worst"] is None:
305
  error_msg = "Please provide an absolute score for the WORST matching image (1-7). / 最も一致していない画像について、絶対評価(1~7)を選択してください。"
 
 
 
 
 
 
 
 
 
 
 
 
306
 
307
  if error_msg:
308
  # The number of components to update is now 53 (1 tab + 52 eval components)
@@ -372,8 +385,6 @@ def validate_and_navigate():
372
  # Keep export tab state as is
373
  return [gr.update()] + display_current_prompt_and_criterion()
374
 
375
-
376
-
377
  def navigate_previous():
378
  GLOBAL_STATE["current_criterion_index"] -= 1
379
  if GLOBAL_STATE["current_criterion_index"] < 0:
 
287
  ]
288
 
289
 
290
+ # ▼▼▼ 修正後の validate_and_navigate 関数 ▼▼▼
291
  # ▼▼▼ 修正後の validate_and_navigate 関数 ▼▼▼
292
  def validate_and_navigate():
293
  ranks = GLOBAL_STATE["current_ranks"]
 
304
  error_msg = "Please provide an absolute score for the BEST matching image (1-7). / 最も一致している画像について、絶対評価(1~7)を選択してください。"
305
  elif is_alignment_criterion and GLOBAL_STATE["current_absolute_score_worst"] is None:
306
  error_msg = "Please provide an absolute score for the WORST matching image (1-7). / 最も一致していない画像について、絶対評価(1~7)を選択してください。"
307
+ # ▼▼▼ 変更箇所 ここから ▼▼▼
308
+ elif (
309
+ is_alignment_criterion
310
+ and GLOBAL_STATE["current_absolute_score"] is not None
311
+ and GLOBAL_STATE["current_absolute_score_worst"] is not None
312
+ and GLOBAL_STATE["current_absolute_score_worst"] > GLOBAL_STATE["current_absolute_score"]
313
+ ):
314
+ error_msg = (
315
+ "The score for the WORST matching image cannot be higher than the score for the BEST matching image.<br>"
316
+ "「最も一致していない画像」のスコアが「最も一致している画像」のスコアを上回ることはできません。"
317
+ )
318
+ # ▲▲▲ 変更箇所 ここまで ▲▲▲
319
 
320
  if error_msg:
321
  # The number of components to update is now 53 (1 tab + 52 eval components)
 
385
  # Keep export tab state as is
386
  return [gr.update()] + display_current_prompt_and_criterion()
387
 
 
 
388
  def navigate_previous():
389
  GLOBAL_STATE["current_criterion_index"] -= 1
390
  if GLOBAL_STATE["current_criterion_index"] < 0: