bs82 commited on
Commit
b74e85b
·
verified ·
1 Parent(s): b2523ab

deploy sd35m: 40 pairs

Browse files
Files changed (2) hide show
  1. app/main.py +3 -1
  2. app/static/index.html +6 -1
app/main.py CHANGED
@@ -137,10 +137,12 @@ async def submit(req: Request):
137
  for v in votes:
138
  p = PAIRS.get(int(v.get("pair_id", -1)))
139
  ch = v.get("choice")
140
- if not p or ch not in ("left", "right"):
141
  continue
142
  if p["kind"] == "catch":
143
  gc = int(ch == p["correct_side"]); n_catch += 1; n_pass += gc
 
 
144
  else:
145
  gc = int(ch == p["guided_side"])
146
  if record: # opt-out: skip persisting votes (results still shown to the participant)
 
137
  for v in votes:
138
  p = PAIRS.get(int(v.get("pair_id", -1)))
139
  ch = v.get("choice")
140
+ if not p or ch not in ("left", "right", "cannot"):
141
  continue
142
  if p["kind"] == "catch":
143
  gc = int(ch == p["correct_side"]); n_catch += 1; n_pass += gc
144
+ elif ch == "cannot":
145
+ gc = None # "Cannot decide" → tie / no preference (excluded from win-rate denominator)
146
  else:
147
  gc = int(ch == p["guided_side"])
148
  if record: # opt-out: skip persisting votes (results still shown to the participant)
app/static/index.html CHANGED
@@ -47,11 +47,14 @@
47
  <div class="mut"><span id="pos">1</span> / <span id="total">0</span></div>
48
  <div class="bar"><div id="prog"></div></div>
49
  <div class="prompt">“<span id="prompt"></span>”</div>
50
- <p class="hint">Click the image you prefer.</p>
51
  <div class="pair">
52
  <div class="opt" id="optL"><img id="imgL"><div class="tag">IMAGE 1</div></div>
53
  <div class="opt" id="optR"><img id="imgR"><div class="tag">IMAGE 2</div></div>
54
  </div>
 
 
 
55
  </div>
56
 
57
  <div id="done" class="card hide">
@@ -121,10 +124,12 @@ $("start").onclick=start;
121
  $("email").addEventListener("keydown",e=>{ if(e.key==="Enter") start(); });
122
  $("optL").onclick=()=>choose("left");
123
  $("optR").onclick=()=>choose("right");
 
124
  document.addEventListener("keydown",e=>{
125
  if($("study").classList.contains("hide")) return;
126
  if(e.key==="ArrowLeft"||e.key==="a"||e.key==="A") choose("left");
127
  if(e.key==="ArrowRight"||e.key==="b"||e.key==="B") choose("right");
 
128
  });
129
  </script>
130
  </body>
 
47
  <div class="mut"><span id="pos">1</span> / <span id="total">0</span></div>
48
  <div class="bar"><div id="prog"></div></div>
49
  <div class="prompt">“<span id="prompt"></span>”</div>
50
+ <p class="hint">Click the image you prefer — or “Cannot decide” if they look equally good.</p>
51
  <div class="pair">
52
  <div class="opt" id="optL"><img id="imgL"><div class="tag">IMAGE 1</div></div>
53
  <div class="opt" id="optR"><img id="imgR"><div class="tag">IMAGE 2</div></div>
54
  </div>
55
+ <div class="center" style="margin-top:14px">
56
+ <button class="primary" id="optC" style="background:#3a3f48">Cannot decide</button>
57
+ </div>
58
  </div>
59
 
60
  <div id="done" class="card hide">
 
124
  $("email").addEventListener("keydown",e=>{ if(e.key==="Enter") start(); });
125
  $("optL").onclick=()=>choose("left");
126
  $("optR").onclick=()=>choose("right");
127
+ $("optC").onclick=()=>choose("cannot");
128
  document.addEventListener("keydown",e=>{
129
  if($("study").classList.contains("hide")) return;
130
  if(e.key==="ArrowLeft"||e.key==="a"||e.key==="A") choose("left");
131
  if(e.key==="ArrowRight"||e.key==="b"||e.key==="B") choose("right");
132
+ if(e.key==="c"||e.key==="C"||e.key==="ArrowDown"||e.key===" ") { e.preventDefault(); choose("cannot"); }
133
  });
134
  </script>
135
  </body>