Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from pathlib import Path | |
| import base64 | |
| from dashboard_theme.theme import inject | |
| st.set_page_config(page_title="FormingStar", layout="wide") | |
| inject("graphite_gold") | |
| PASSWORD = "ajin2025" | |
| # ------------------------------- | |
| # ์ธ์ ์ด๊ธฐํ | |
| # ------------------------------- | |
| if "authenticated" not in st.session_state: | |
| st.session_state["authenticated"] = False | |
| # ------------------------------- | |
| # ๋ก๊ทธ์ธ ํ๋ฉด | |
| # ------------------------------- | |
| if not st.session_state["authenticated"]: | |
| st.title("๐ FormingStar ์ ์ ์ธ์ฆ") | |
| pwd = st.text_input("๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ์ธ์", type="password") | |
| if st.button("์ ์ํ๊ธฐ"): | |
| if pwd == PASSWORD: | |
| st.session_state["authenticated"] = True | |
| st.success("โ ์ธ์ฆ ์ฑ๊ณต! ์ด์ ์๋จ ํญ์์ ์๋ฎฌ๋ ์ด์ ์ผ๋ก ์ด๋ํ์ธ์.") | |
| st.rerun() | |
| else: | |
| st.error("โ ๋น๋ฐ๋ฒํธ๊ฐ ํ๋ ธ์ต๋๋ค.") | |
| # ------------------------------- | |
| # ์ธ์ฆ ํ ๋ฉ์ธ ํ๋ฉด | |
| # ------------------------------- | |
| else: | |
| # ------------------------------- | |
| # CSS (Home.py์ ๋์ผ) | |
| # ------------------------------- | |
| st.markdown( | |
| """ | |
| <style> | |
| .block-container { padding-top: 1.25rem !important; } | |
| .logo-wrap { display:flex; justify-content:center; margin: 6px 0 10px; } | |
| .logo-wrap img { width: clamp(160px, 24vw, 320px); height: auto; } | |
| h2.hero-title { | |
| margin: 4px 0 6px !important; | |
| text-align:center; color: var(--text); | |
| font-size: clamp(22px, 3vw, 36px); | |
| line-height: 1.12; | |
| } | |
| p.hero-sub { | |
| margin: 2px 0 8px !important; | |
| text-align:center; color: var(--muted); | |
| } | |
| hr.hr-thin { | |
| border: 0; border-top: 1px solid var(--border); | |
| margin: 10px 0 !important; | |
| } | |
| .notice { | |
| background-color:#2A2F3A; color:#E0E6ED; | |
| padding:10px 16px; border-radius:10px; text-align:center; | |
| max-width:640px; margin: 8px auto 0; | |
| font-weight:600; border:1px solid var(--border); | |
| box-shadow: 0 8px 20px rgba(0,0,0,.25); | |
| } | |
| </style> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| # ------------------------------- | |
| # ๐ธ ํ์ฌ ๋ก๊ณ | |
| # ------------------------------- | |
| def find_logo(): | |
| here = Path(__file__).parent | |
| for p in [ | |
| here / "formingstar.png", | |
| here / "assets" / "formingstar.png", | |
| Path.cwd() / "formingstar.png" | |
| ]: | |
| if p.exists(): | |
| return p | |
| return None | |
| logo_path = find_logo() | |
| if logo_path: | |
| logo_b64 = base64.b64encode(logo_path.read_bytes()).decode() | |
| st.markdown( | |
| f'<div class="logo-wrap"><img src="data:image/png;base64,{logo_b64}" alt="FORMINGSTAR Logo"></div>', | |
| unsafe_allow_html=True | |
| ) | |
| else: | |
| st.warning("๋ก๊ณ ํ์ผ(formingstar.png)์ ์ฐพ์ง ๋ชปํ์ด์. Home.py์ ๊ฐ์ ํด๋ ๋๋ /assets ํด๋์ ์๋์ง ํ์ธํด ์ฃผ์ธ์.") | |
| # ------------------------------- | |
| # ๐ธ ๋ฉ์ธ ํ์ดํ & ์ค๋ช | |
| # ------------------------------- | |
| st.markdown('<h2 class="hero-title">AIโ๋น ๋ฐ์ดํฐ ๊ธฐ๋ฐ ์ฑํ์ฑ ์์ธก ๋ชจ๋ธ</h2>', unsafe_allow_html=True) | |
| st.markdown('<p class="hero-sub">์๋์ฐจ ์ฐจ์ฒด ๊ธํ ํด์ ๊ณผ์ ์ ์ฝ๊ฒ ๋ฐฐ์ฐ๊ณ ์ค์ตํ ์ ์๋ ๊ฐ์ด๋ ํ๋ซํผ์ ๋๋ค.</p>', unsafe_allow_html=True) | |
| st.markdown('<hr class="hr-thin">', unsafe_allow_html=True) | |
| # ------------------------------- | |
| # ๐ธ ๋ฒํผ โ ํ์ด์ง ์ด๋ | |
| # ------------------------------- | |
| left, mid, right = st.columns([1, 1.2, 1]) | |
| with mid: | |
| if st.button("์๋ฎฌ๋ ์ด์ ์์ํ๊ธฐ", use_container_width=True): | |
| st.switch_page("pages/1_Simulation.py") | |
| st.markdown('<hr class="hr-thin">', unsafe_allow_html=True) | |
| # ------------------------------- | |
| # ๐ธ ์๋ด ๋ฌธ๊ตฌ | |
| # ------------------------------- | |
| st.markdown( | |
| '<div class="notice">์ข์ธก ์ฌ์ด๋๋ฐ์์๋ ์๋ฎฌ๋ ์ด์ ๋ฉ๋ด๋ก ์ด๋ํ ์ ์์ต๋๋ค.</div>', | |
| unsafe_allow_html=True | |
| ) | |