forouzanfallah commited on
Commit
ed1313f
·
1 Parent(s): 7b08c83

RTS Human Evaluation

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
37
+ *.tif filter=lfs diff=lfs merge=lfs -text
38
+ *.tiff filter=lfs diff=lfs merge=lfs -text
39
+ *.png filter=lfs diff=lfs merge=lfs -text
40
+ *.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -15,9 +15,9 @@ from filelock import FileLock
15
  # Configuration
16
  # ----------------------
17
 
18
- SR_DIR = os.environ.get("SR_DIR", "./data/sr")
19
- GT_DIR = os.environ.get("GT_DIR", "./data/gt")
20
- RESULTS_DIR = os.environ.get("RESULTS_DIR", "./results")
21
  PROGRESS_PATH = os.path.join(RESULTS_DIR, "progress.json")
22
  ALL_RESULTS_JSONL = os.path.join(RESULTS_DIR, "all_results.jsonl")
23
  SAVE_PII = True # set False to only store hashed user_id
@@ -213,8 +213,8 @@ def load_dataset(sr_dir: str, gt_dir: str) -> List[Sample]:
213
  # Progress & results I/O
214
  # ----------------------
215
 
216
- def hash_user_id(name: str, address: str) -> str:
217
- norm = (name or "").strip().lower() + "|" + (address or "").strip().lower()
218
  return hashlib.sha256(norm.encode("utf-8")).hexdigest()[:16]
219
 
220
 
@@ -363,14 +363,14 @@ def step_display_index(step: int, detect_choice: str | None) -> tuple[int, int]:
363
  # Gradio callbacks (core)
364
  # ----------------------
365
 
366
- def start_or_resume(name: str, address: str):
367
- if not name or not address:
368
- raise gr.Error("Please enter your name and address to begin.")
369
 
370
  ensure_paths()
371
  samples = load_dataset(SR_DIR, GT_DIR)
372
 
373
- uid = hash_user_id(name, address)
374
  progress = load_progress()
375
  if uid not in progress:
376
  progress[uid] = {"seen": []}
@@ -429,7 +429,7 @@ def update_overlay(test_img: Image.Image, selected_tiles: List[str] | None):
429
 
430
  def _save_record_and_progress(
431
  name: str,
432
- address: str,
433
  uid: str,
434
  samples: List[Sample],
435
  user_seen: List[str],
@@ -442,8 +442,8 @@ def _save_record_and_progress(
442
  reasoning: str,
443
  ):
444
  """Common save logic used by both 'finish' and 'next image' paths."""
445
- if not name or not address:
446
- raise gr.Error("Please enter your name and address.")
447
  if detection_choice not in {"Yes", "No", "Unsure"}:
448
  detection_choice = "Unsure"
449
  valid_clarity = {
@@ -464,7 +464,7 @@ def _save_record_and_progress(
464
  "timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
465
  "user_id": uid,
466
  "name": name if SAVE_PII else None,
467
- "address": address if SAVE_PII else None,
468
  "sample_id": sample.sample_id,
469
  "sr_path": sample.sr_path,
470
  "gt_path": sample.gt_path,
@@ -499,7 +499,7 @@ def _save_record_and_progress(
499
 
500
  def submit_finish(
501
  name: str,
502
- address: str,
503
  uid: str,
504
  samples: List[Sample],
505
  user_seen: List[str],
@@ -513,7 +513,7 @@ def submit_finish(
513
  ):
514
  """Save and show Thank You (no auto-next)."""
515
  progress = _save_record_and_progress(
516
- name, address, uid, samples, user_seen, idx, a_is_sr,
517
  detection_choice, confidence, selected_tiles, clarity_choice, reasoning
518
  )
519
 
@@ -549,7 +549,7 @@ def submit_finish(
549
 
550
  def submit_next_image(
551
  name: str,
552
- address: str,
553
  uid: str,
554
  samples: List[Sample],
555
  user_seen: List[str],
@@ -563,7 +563,7 @@ def submit_next_image(
563
  ):
564
  """Save and immediately load the next sample."""
565
  progress = _save_record_and_progress(
566
- name, address, uid, samples, user_seen, idx, a_is_sr,
567
  detection_choice, confidence, selected_tiles, clarity_choice, reasoning
568
  )
569
  # NEW — mark global done & release current reservation
@@ -728,7 +728,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
728
  # Retrogressive Thaw Slump (RTS) Human Evaluation
729
 
730
  **Instructions:**
731
- 1. Enter your name and address, then click **Start / Resume**.
732
  2. Use **Next** and **Back** to go through the questions.
733
  3. On the **last step**, choose **Submit & Next Image** to continue, or **Submit & Finish** to end and see a Thank You screen (with **Start Again**).
734
  """
@@ -745,7 +745,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
745
  with gr.Group() as start_group:
746
  with gr.Row():
747
  name = gr.Textbox(label="Full name", placeholder="Jane Doe", autofocus=True)
748
- address = gr.Textbox(label="Address", placeholder="123 Pine St, City / or Email")
749
  start_btn = gr.Button("Start / Resume", variant="primary")
750
  status = gr.Markdown("\n")
751
 
@@ -823,7 +823,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
823
  # --- Wiring ---
824
  start_event = start_btn.click(
825
  start_or_resume,
826
- inputs=[name, address],
827
  outputs=[
828
  state_uid, state_samples, state_seen, state_idx, state_a_is_sr,
829
  test_img, overlay_img, image_a, image_b, status, your_jsonl_path, eval_panel, tiles, state_step, intro_md, start_group
@@ -867,7 +867,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
867
  submit_finish,
868
  inputs=[
869
  name,
870
- address,
871
  state_uid,
872
  state_samples,
873
  state_seen,
@@ -906,7 +906,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
906
  submit_next_image,
907
  inputs=[
908
  name,
909
- address,
910
  state_uid,
911
  state_samples,
912
  state_seen,
@@ -947,10 +947,10 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
947
  outputs=[step_status, group_detection, group_confidence, group_tiles, group_clarity, group_reasoning, back_btn, next_btn],
948
  )
949
 
950
- # Restart: start again using current name/address
951
  restart_event = restart_btn.click(
952
  start_or_resume,
953
- inputs=[name, address],
954
  outputs=[
955
  state_uid, state_samples, state_seen, state_idx, state_a_is_sr,
956
  test_img, overlay_img, image_a, image_b, status, your_jsonl_path, eval_panel, tiles, state_step, intro_md, start_group
 
15
  # Configuration
16
  # ----------------------
17
 
18
+ SR_DIR = os.environ.get("SR_DIR", "data/sr")
19
+ GT_DIR = os.environ.get("GT_DIR", "data/gt")
20
+ RESULTS_DIR = os.environ.get("RESULTS_DIR", "results")
21
  PROGRESS_PATH = os.path.join(RESULTS_DIR, "progress.json")
22
  ALL_RESULTS_JSONL = os.path.join(RESULTS_DIR, "all_results.jsonl")
23
  SAVE_PII = True # set False to only store hashed user_id
 
213
  # Progress & results I/O
214
  # ----------------------
215
 
216
+ def hash_user_id(name: str, email: str) -> str:
217
+ norm = (name or "").strip().lower() + "|" + (email or "").strip().lower()
218
  return hashlib.sha256(norm.encode("utf-8")).hexdigest()[:16]
219
 
220
 
 
363
  # Gradio callbacks (core)
364
  # ----------------------
365
 
366
+ def start_or_resume(name: str, email: str):
367
+ if not name or not email:
368
+ raise gr.Error("Please enter your name and email to begin.")
369
 
370
  ensure_paths()
371
  samples = load_dataset(SR_DIR, GT_DIR)
372
 
373
+ uid = hash_user_id(name, email)
374
  progress = load_progress()
375
  if uid not in progress:
376
  progress[uid] = {"seen": []}
 
429
 
430
  def _save_record_and_progress(
431
  name: str,
432
+ email: str,
433
  uid: str,
434
  samples: List[Sample],
435
  user_seen: List[str],
 
442
  reasoning: str,
443
  ):
444
  """Common save logic used by both 'finish' and 'next image' paths."""
445
+ if not name or not email:
446
+ raise gr.Error("Please enter your name and email.")
447
  if detection_choice not in {"Yes", "No", "Unsure"}:
448
  detection_choice = "Unsure"
449
  valid_clarity = {
 
464
  "timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
465
  "user_id": uid,
466
  "name": name if SAVE_PII else None,
467
+ "email": email if SAVE_PII else None,
468
  "sample_id": sample.sample_id,
469
  "sr_path": sample.sr_path,
470
  "gt_path": sample.gt_path,
 
499
 
500
  def submit_finish(
501
  name: str,
502
+ email: str,
503
  uid: str,
504
  samples: List[Sample],
505
  user_seen: List[str],
 
513
  ):
514
  """Save and show Thank You (no auto-next)."""
515
  progress = _save_record_and_progress(
516
+ name, email, uid, samples, user_seen, idx, a_is_sr,
517
  detection_choice, confidence, selected_tiles, clarity_choice, reasoning
518
  )
519
 
 
549
 
550
  def submit_next_image(
551
  name: str,
552
+ email: str,
553
  uid: str,
554
  samples: List[Sample],
555
  user_seen: List[str],
 
563
  ):
564
  """Save and immediately load the next sample."""
565
  progress = _save_record_and_progress(
566
+ name, email, uid, samples, user_seen, idx, a_is_sr,
567
  detection_choice, confidence, selected_tiles, clarity_choice, reasoning
568
  )
569
  # NEW — mark global done & release current reservation
 
728
  # Retrogressive Thaw Slump (RTS) Human Evaluation
729
 
730
  **Instructions:**
731
+ 1. Enter your name and email address, then click **Start / Resume**.
732
  2. Use **Next** and **Back** to go through the questions.
733
  3. On the **last step**, choose **Submit & Next Image** to continue, or **Submit & Finish** to end and see a Thank You screen (with **Start Again**).
734
  """
 
745
  with gr.Group() as start_group:
746
  with gr.Row():
747
  name = gr.Textbox(label="Full name", placeholder="Jane Doe", autofocus=True)
748
+ email = gr.Textbox(label="Email address", placeholder="jane@example.com")
749
  start_btn = gr.Button("Start / Resume", variant="primary")
750
  status = gr.Markdown("\n")
751
 
 
823
  # --- Wiring ---
824
  start_event = start_btn.click(
825
  start_or_resume,
826
+ inputs=[name, email],
827
  outputs=[
828
  state_uid, state_samples, state_seen, state_idx, state_a_is_sr,
829
  test_img, overlay_img, image_a, image_b, status, your_jsonl_path, eval_panel, tiles, state_step, intro_md, start_group
 
867
  submit_finish,
868
  inputs=[
869
  name,
870
+ email,
871
  state_uid,
872
  state_samples,
873
  state_seen,
 
906
  submit_next_image,
907
  inputs=[
908
  name,
909
+ email,
910
  state_uid,
911
  state_samples,
912
  state_seen,
 
947
  outputs=[step_status, group_detection, group_confidence, group_tiles, group_clarity, group_reasoning, back_btn, next_btn],
948
  )
949
 
950
+ # Restart: start again using current name/email
951
  restart_event = restart_btn.click(
952
  start_or_resume,
953
+ inputs=[name, email],
954
  outputs=[
955
  state_uid, state_samples, state_seen, state_idx, state_a_is_sr,
956
  test_img, overlay_img, image_a, image_b, status, your_jsonl_path, eval_panel, tiles, state_step, intro_md, start_group
data/gt/train_nitze_016.png ADDED

Git LFS Details

  • SHA256: 9622c62b6f8e4419be1f78496ca0d9ed0e5d89a995903c9318b62388c3a5b7a5
  • Pointer size: 130 Bytes
  • Size of remote file: 63.3 kB
data/gt/train_nitze_106.png ADDED

Git LFS Details

  • SHA256: 9a8af6118690ed0e2f556b378566fa20712265e2dced832cde861cce1975ffc6
  • Pointer size: 130 Bytes
  • Size of remote file: 64.8 kB
data/gt/train_yg_078.png ADDED

Git LFS Details

  • SHA256: a710c7485314c4b4c1375258c067ecd9058d1496d8b3170c23ca94b93f4e5663
  • Pointer size: 130 Bytes
  • Size of remote file: 70.3 kB
data/gt/train_yg_300.png ADDED

Git LFS Details

  • SHA256: 660f307020c609f9e6ad2c1e6037a764668ac634583cc76551544002b31e0880
  • Pointer size: 130 Bytes
  • Size of remote file: 73.1 kB
data/gt/train_yg_304.png ADDED

Git LFS Details

  • SHA256: 056a1229428e24469aea99e8762f602e65f8aef2a38c6d1605e5e67edde70270
  • Pointer size: 130 Bytes
  • Size of remote file: 73.2 kB
data/sr/train_nitze_016.png ADDED

Git LFS Details

  • SHA256: 0ddbdc6f4ccbf87d72d35d744add1cb6a0ca699b482c6ac4ee26c5c622333f50
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
data/sr/train_nitze_106.png ADDED

Git LFS Details

  • SHA256: 5beb9238f9c446c61b2f1c5402cdcdd5f388f182bb1865779129ca66cfe4576a
  • Pointer size: 130 Bytes
  • Size of remote file: 92.1 kB
data/sr/train_yg_078.png ADDED

Git LFS Details

  • SHA256: caf9a0a191fb1d87a4e74ffca59c83a39ee78453f9805f7784b8b0c62242b5c7
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
data/sr/train_yg_300.png ADDED

Git LFS Details

  • SHA256: 9a64702b51c938ca9e2004526c9c062099a136b39a04d3b09b331f866d1c2aa7
  • Pointer size: 131 Bytes
  • Size of remote file: 137 kB
data/sr/train_yg_304.png ADDED

Git LFS Details

  • SHA256: 079a913c584643d74eb852b4b735b021b67c1463538935769a5fcbe8baf9becf
  • Pointer size: 131 Bytes
  • Size of remote file: 117 kB
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio>=4.29
2
+ pillow
3
+ numpy
4
+ filelock