Peiran commited on
Commit
6803948
·
1 Parent(s): 78b57a9

problem fix

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +5 -4
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -6,7 +6,7 @@ import os
6
  import uuid
7
  from datetime import datetime
8
  from io import BytesIO
9
- from typing import Dict, List, Tuple
10
 
11
  import gradio as gr
12
  try:
@@ -139,7 +139,7 @@ def _read_existing_eval_keys(task_name: str) -> set:
139
  return keys
140
 
141
 
142
- def _schedule_round_robin_by_test_id(pairs: List[Dict[str, str]], seed: int | None = None) -> List[Dict[str, str]]:
143
  """Interleave pairs across test_ids for balanced coverage; shuffle within each group.
144
  """
145
  groups: Dict[str, List[Dict[str, str]]] = {}
@@ -248,7 +248,7 @@ def _append_local_persist_csv(task_name: str, row: Dict[str, object]) -> bool:
248
  return False
249
 
250
 
251
- def _upload_eval_record_to_dataset(task_name: str, row: Dict[str, object]) -> tuple[bool, str]:
252
  """Upload a single-eval JSONL record to a dataset repo.
253
  Repo is taken from EVAL_REPO_ID env or defaults to 'peiranli0930/VisEval'.
254
  Returns (ok, message) for UI feedback and debugging.
@@ -296,9 +296,10 @@ def on_task_change(task_name: str, _state_pairs: List[Dict[str, str]]):
296
  # Pick display order according to swap flag
297
  a_path = pair["model2_path"] if pair.get("swap") else pair["model1_path"]
298
  b_path = pair["model1_path"] if pair.get("swap") else pair["model2_path"]
 
299
  return (
300
  pairs,
301
- gr.update(value=0, minimum=0, maximum=len(pairs) - 1, visible=(len(pairs) > 1)),
302
  gr.update(value=header),
303
  _resolve_image_path(pair["org_img"]),
304
  _resolve_image_path(a_path),
 
6
  import uuid
7
  from datetime import datetime
8
  from io import BytesIO
9
+ from typing import Dict, List, Tuple, Optional
10
 
11
  import gradio as gr
12
  try:
 
139
  return keys
140
 
141
 
142
+ def _schedule_round_robin_by_test_id(pairs: List[Dict[str, str]], seed: Optional[int] = None) -> List[Dict[str, str]]:
143
  """Interleave pairs across test_ids for balanced coverage; shuffle within each group.
144
  """
145
  groups: Dict[str, List[Dict[str, str]]] = {}
 
248
  return False
249
 
250
 
251
+ def _upload_eval_record_to_dataset(task_name: str, row: Dict[str, object]) -> Tuple[bool, str]:
252
  """Upload a single-eval JSONL record to a dataset repo.
253
  Repo is taken from EVAL_REPO_ID env or defaults to 'peiranli0930/VisEval'.
254
  Returns (ok, message) for UI feedback and debugging.
 
296
  # Pick display order according to swap flag
297
  a_path = pair["model2_path"] if pair.get("swap") else pair["model1_path"]
298
  b_path = pair["model1_path"] if pair.get("swap") else pair["model2_path"]
299
+ max_index = max(0, len(pairs) - 1)
300
  return (
301
  pairs,
302
+ gr.update(value=0, minimum=0, maximum=max_index, visible=(len(pairs) > 1)),
303
  gr.update(value=header),
304
  _resolve_image_path(pair["org_img"]),
305
  _resolve_image_path(a_path),