diff --git a/app.py b/app.py index 6b6e117..946ca66 100644 --- a/app.py +++ b/app.py @@ -17,6 +17,7 @@ from pathlib import Path import qrcode import streamlit as st +from streamlit_autorefresh import st_autorefresh DATA_PATH = os.environ.get( "DATA_PATH", str(Path(__file__).parent / "hackathon.json") @@ -446,8 +447,34 @@ def render_stage_topics(data): def render_stage_vote(data): - st.markdown('
πŸ—³ νˆ¬ν‘œ μ‹œμž‘
', unsafe_allow_html=True) - st.info("Task 11μ—μ„œ κ΅¬ν˜„") + st_autorefresh(interval=3000, key="vote_poll") + + st.markdown('
πŸ—³ νˆ¬ν‘œ
', unsafe_allow_html=True) + st.markdown( + '
πŸ“± νœ΄λŒ€ν°μœΌλ‘œ QR μŠ€μΊ” β†’ 본인 이름 선택 β†’ νˆ¬ν‘œ
', + unsafe_allow_html=True, + ) + + vote_url = compute_vote_url() + qr_png = make_qr_png(vote_url) + + c1, c2, c3 = st.columns([1, 2, 1]) + with c2: + st.image(qr_png, use_container_width=False, width=500) + st.markdown( + f'
{vote_url}
', + unsafe_allow_html=True, + ) + + votes = data.get("votes", []) + total = len(data.get("people", [])) + voted = len(votes) + pct = int(100 * voted / total) if total else 0 + st.markdown( + f'
{voted} / {total}
', + unsafe_allow_html=True, + ) + st.progress(pct / 100 if total else 0) def render_voter():