Spaces:
Sleeping
Sleeping
Youngsun Lim
commited on
Commit
ยท
ffbec17
1
Parent(s):
cd69432
251024
Browse files
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)
|