kimtaeyeong1229 commited on
Commit
138d3c8
Β·
verified Β·
1 Parent(s): 396ad9b

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +84 -0
app.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Main Streamlit app β€” sidebar routing."""
2
+ import streamlit as st
3
+
4
+ # Page config must be called first
5
+ st.set_page_config(
6
+ page_title="AI ν•™μŠ΅ ν”Œλž«νΌ | 타이타닉 ML/DL",
7
+ page_icon="πŸ€–",
8
+ layout="wide",
9
+ initial_sidebar_state="expanded",
10
+ )
11
+
12
+ # Import pages
13
+ from views import home, ml_lab, dl_lab, roadmap, career
14
+
15
+ PAGES = {
16
+ "ν™ˆ (EDA)": home,
17
+ "ML μ‹€μŠ΅": ml_lab,
18
+ "λ”₯λŸ¬λ‹ μ‹€μŠ΅": dl_lab,
19
+ "ν•™μŠ΅ λ‘œλ“œλ§΅": roadmap,
20
+ "AI 직무 뢄석": career,
21
+ }
22
+
23
+ ICONS = {
24
+ "ν™ˆ (EDA)": "🏠",
25
+ "ML μ‹€μŠ΅": "πŸ”¬",
26
+ "λ”₯λŸ¬λ‹ μ‹€μŠ΅": "🧠",
27
+ "ν•™μŠ΅ λ‘œλ“œλ§΅": "πŸ—ΊοΈ",
28
+ "AI 직무 뢄석": "πŸ’Ό",
29
+ }
30
+
31
+ # ── Session state for active page ──
32
+ if "page" not in st.session_state:
33
+ st.session_state.page = "ν™ˆ (EDA)"
34
+
35
+ page_keys = list(PAGES.keys())
36
+ active_idx = page_keys.index(st.session_state.page) + 1 # 1-based for CSS nth-of-type
37
+
38
+ # ── CSS: hide auto nav, style sidebar buttons ──
39
+ st.markdown(f"""
40
+ <style>
41
+ [data-testid="stSidebarNav"] {{
42
+ display: none;
43
+ }}
44
+ section[data-testid="stSidebar"] .stButton button {{
45
+ width: 100%;
46
+ text-align: left;
47
+ background-color: transparent;
48
+ border: none;
49
+ border-radius: 6px;
50
+ padding: 8px 14px;
51
+ font-size: 14px;
52
+ cursor: pointer;
53
+ transition: background-color 0.15s;
54
+ }}
55
+ section[data-testid="stSidebar"] .stButton button:hover {{
56
+ background-color: rgba(255, 255, 255, 0.08);
57
+ }}
58
+ section[data-testid="stSidebar"] .stButton:nth-of-type({active_idx}) button {{
59
+ background-color: rgba(99, 155, 255, 0.22) !important;
60
+ border-left: 3px solid #639BFF !important;
61
+ font-weight: 600;
62
+ }}
63
+ </style>
64
+ """, unsafe_allow_html=True)
65
+
66
+ # ── Sidebar navigation ──
67
+ st.sidebar.title("AI ν•™μŠ΅ ν”Œλž«νΌ")
68
+ st.sidebar.markdown("νƒ€μ΄νƒ€λ‹‰μœΌλ‘œ λ°°μš°λŠ” ML/DL")
69
+ st.sidebar.markdown("---")
70
+
71
+ for page_name in page_keys:
72
+ if st.sidebar.button(f"{ICONS[page_name]} {page_name}", key=f"nav_{page_name}"):
73
+ st.session_state.page = page_name
74
+ st.rerun()
75
+
76
+ st.sidebar.markdown("---")
77
+ st.sidebar.markdown("""
78
+ **데이터**: Seaborn Titanic
79
+ **ν”„λ ˆμž„μ›Œν¬**: sklearn + PyTorch
80
+ **배포**: Hugging Face Spaces
81
+ """)
82
+
83
+ # ── Route to selected page ──
84
+ PAGES[st.session_state.page].show()