Youngsun Lim commited on
Commit
ffbec17
ยท
1 Parent(s): cd69432
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -15,18 +15,14 @@ def _save_btn_state(pid_text: str, moved_a: bool, moved_p: bool):
15
  ok = bool(pid_text and pid_text.strip()) and bool(moved_a) and bool(moved_p)
16
  return gr.update(interactive=ok, variant=("primary" if ok else "secondary"))
17
 
18
- # PID๊ฐ€ ๋ฐ”๋€” ๋•Œ ํ˜„์žฌ moved ์ƒํƒœ์™€ ํ•จ๊ป˜ ์žฌ๊ณ„์‚ฐ
19
- pid.change(_save_btn_state, inputs=[pid, moved_action, moved_phys], outputs=save_next)
20
 
21
  # ์•ก์…˜ ์Šฌ๋ผ์ด๋”๊ฐ€ ๋ฐ”๋€Œ๋ฉด moved_action=True๋กœ ์„ธํŒ…ํ•˜๊ณ  ๋ฒ„ํŠผ ํ† ๊ธ€
22
  def _on_action_changed(pid_text: str, other_moved: bool):
23
  return True, _save_btn_state(pid_text, True, other_moved)
24
- score_action.change(_on_action_changed, inputs=[pid, moved_phys], outputs=[moved_action, save_next])
25
 
26
  # ๋ฌผ๋ฆฌ ์Šฌ๋ผ์ด๋”๋„ ๋™์ผ ๋กœ์ง
27
  def _on_phys_changed(pid_text: str, other_moved: bool):
28
  return True, _save_btn_state(pid_text, other_moved, True)
29
- score_phys.change(_on_phys_changed, inputs=[pid, moved_action], outputs=[moved_phys, save_next])
30
 
31
 
32
  REWARD_FILE = "reward_codes.csv" # ๋ฆฌ์›Œ๋“œ ์ฝ”๋“œ ๊ธฐ๋ก์šฉ ํŒŒ์ผ (HF dataset ์•ˆ์— ์ €์žฅ)
@@ -660,6 +656,10 @@ with gr.Blocks(css=CLEAN_BG_CSS) as demo:
660
  return gr.update(interactive=enabled, variant=("primary" if enabled else "secondary"))
661
  pid.change(_toggle_by_pid, inputs=pid, outputs=save_next)
662
 
 
 
 
 
663
  page_thanks = gr.Group(visible=False)
664
  with page_thanks:
665
  reward_msg = gr.Markdown(visible=False)
 
15
  ok = bool(pid_text and pid_text.strip()) and bool(moved_a) and bool(moved_p)
16
  return gr.update(interactive=ok, variant=("primary" if ok else "secondary"))
17
 
 
 
18
 
19
  # ์•ก์…˜ ์Šฌ๋ผ์ด๋”๊ฐ€ ๋ฐ”๋€Œ๋ฉด moved_action=True๋กœ ์„ธํŒ…ํ•˜๊ณ  ๋ฒ„ํŠผ ํ† ๊ธ€
20
  def _on_action_changed(pid_text: str, other_moved: bool):
21
  return True, _save_btn_state(pid_text, True, other_moved)
 
22
 
23
  # ๋ฌผ๋ฆฌ ์Šฌ๋ผ์ด๋”๋„ ๋™์ผ ๋กœ์ง
24
  def _on_phys_changed(pid_text: str, other_moved: bool):
25
  return True, _save_btn_state(pid_text, other_moved, True)
 
26
 
27
 
28
  REWARD_FILE = "reward_codes.csv" # ๋ฆฌ์›Œ๋“œ ์ฝ”๋“œ ๊ธฐ๋ก์šฉ ํŒŒ์ผ (HF dataset ์•ˆ์— ์ €์žฅ)
 
656
  return gr.update(interactive=enabled, variant=("primary" if enabled else "secondary"))
657
  pid.change(_toggle_by_pid, inputs=pid, outputs=save_next)
658
 
659
+ pid.change(_save_btn_state, inputs=[pid, moved_action, moved_phys], outputs=save_next)
660
+ score_action.change(_on_action_changed, inputs=[pid, moved_phys], outputs=[moved_action, save_next])
661
+ score_phys.change(_on_phys_changed, inputs=[pid, moved_action], outputs=[moved_phys, save_next])
662
+
663
  page_thanks = gr.Group(visible=False)
664
  with page_thanks:
665
  reward_msg = gr.Markdown(visible=False)