Spaces:
Sleeping
Sleeping
Download app.py from mjkalas/Student_Graduation_Planner: direct link, hf CLI and curl.
- Browser
- Download file 22.5 kB
-
https://huggingface.co/spaces/mjkalas/Student_Graduation_Planner/resolve/main/app.py
- Command line
-
hf download hf://spaces/mjkalas/Student_Graduation_Planner/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mjkalas/Student_Graduation_Planner/resolve/main/app.py
22.5 kB
| import streamlit as st | |
| # ββ Ole Miss brand colors ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.set_page_config(page_title="Ole Miss Degree Planner", page_icon="π", layout="wide") | |
| st.markdown(""" | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Sans+3:wght@300;400;600&display=swap'); | |
| :root { | |
| --navy: #002147; | |
| --red: #CE1126; | |
| --gold: #C8A84B; | |
| --light: #F4F6F9; | |
| --card: #FFFFFF; | |
| --border: #D8DDE6; | |
| --text: #1A1A2E; | |
| --muted: #6B7280; | |
| } | |
| html, body, [class*="css"] { | |
| font-family: 'Source Sans 3', sans-serif; | |
| background-color: var(--light); | |
| color: var(--text); | |
| } | |
| /* Header */ | |
| .hero { | |
| background: linear-gradient(135deg, var(--navy) 0%, #003366 100%); | |
| border-bottom: 4px solid var(--red); | |
| padding: 2rem 2.5rem 1.5rem; | |
| border-radius: 12px; | |
| margin-bottom: 1.5rem; | |
| color: white; | |
| } | |
| .hero h1 { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 2.4rem; | |
| font-weight: 900; | |
| margin: 0 0 0.25rem 0; | |
| letter-spacing: -0.5px; | |
| } | |
| .hero p { | |
| font-size: 1rem; | |
| color: rgba(255,255,255,0.75); | |
| margin: 0; | |
| font-weight: 300; | |
| } | |
| .accent { color: var(--gold); } | |
| /* Cards */ | |
| .card { | |
| background: var(--card); | |
| border: 1px solid var(--border); | |
| border-radius: 10px; | |
| padding: 1.25rem 1.5rem; | |
| margin-bottom: 1rem; | |
| box-shadow: 0 2px 8px rgba(0,33,71,0.07); | |
| } | |
| .card-header { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 1.1rem; | |
| font-weight: 700; | |
| color: var(--navy); | |
| border-bottom: 2px solid var(--red); | |
| padding-bottom: 0.4rem; | |
| margin-bottom: 0.75rem; | |
| } | |
| /* Remaining course pill */ | |
| .course-pill { | |
| display: inline-block; | |
| background: #EEF2FF; | |
| border: 1px solid #BDC9E8; | |
| border-left: 4px solid var(--navy); | |
| color: var(--navy); | |
| font-size: 0.85rem; | |
| font-weight: 600; | |
| padding: 0.3rem 0.75rem; | |
| border-radius: 6px; | |
| margin: 0.2rem 0.2rem 0.2rem 0; | |
| } | |
| .course-pill.done { | |
| background: #F0FDF4; | |
| border-left-color: #16A34A; | |
| color: #15803D; | |
| text-decoration: line-through; | |
| opacity: 0.65; | |
| } | |
| /* GPA badge */ | |
| .gpa-badge { | |
| background: linear-gradient(135deg, var(--navy), #003366); | |
| color: white; | |
| border-radius: 12px; | |
| padding: 1.5rem; | |
| text-align: center; | |
| border: 3px solid var(--gold); | |
| } | |
| .gpa-number { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 3.5rem; | |
| font-weight: 900; | |
| color: var(--gold); | |
| line-height: 1; | |
| } | |
| .gpa-label { | |
| font-size: 0.85rem; | |
| color: rgba(255,255,255,0.7); | |
| margin-top: 0.25rem; | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| /* Stat boxes */ | |
| .stat-box { | |
| background: var(--navy); | |
| color: white; | |
| border-radius: 8px; | |
| padding: 0.9rem 1rem; | |
| text-align: center; | |
| } | |
| .stat-num { font-size: 1.8rem; font-weight: 700; color: var(--gold); } | |
| .stat-lbl { font-size: 0.75rem; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.5px; } | |
| /* Tab styling */ | |
| div[data-testid="stTabs"] button { | |
| font-family: 'Source Sans 3', sans-serif !important; | |
| font-weight: 600 !important; | |
| color: var(--navy) !important; | |
| } | |
| div[data-testid="stTabs"] button[aria-selected="true"] { | |
| color: var(--red) !important; | |
| border-bottom-color: var(--red) !important; | |
| } | |
| /* Selectbox / dropdown */ | |
| div[data-testid="stSelectbox"] label, div[data-testid="stMultiSelect"] label { | |
| font-weight: 600; | |
| color: var(--navy); | |
| } | |
| /* Checkbox label */ | |
| .stCheckbox label { font-size: 0.9rem; } | |
| /* Red badge for remaining */ | |
| .badge-remaining { | |
| display: inline-block; | |
| background: var(--red); | |
| color: white; | |
| font-size: 0.7rem; | |
| font-weight: 700; | |
| padding: 0.1rem 0.5rem; | |
| border-radius: 99px; | |
| vertical-align: middle; | |
| margin-left: 0.4rem; | |
| } | |
| .badge-done { | |
| display: inline-block; | |
| background: #16A34A; | |
| color: white; | |
| font-size: 0.7rem; | |
| font-weight: 700; | |
| padding: 0.1rem 0.5rem; | |
| border-radius: 99px; | |
| vertical-align: middle; | |
| margin-left: 0.4rem; | |
| } | |
| /* Divider */ | |
| .divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # ββ Course Data ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| GRADE_MAP = {"A": 4.0, "B": 3.0, "C": 2.0, "D": 1.0, "F": 0.0, "W": None, "In Progress": None} | |
| MAJORS = { | |
| "Accountancy (B.Accy.)": { | |
| "General Education / Core": [ | |
| "WRIT 100/101 β First Year Writing I", | |
| "WRIT/LIBA 102 β First Year Writing II", | |
| "Natural Science with Lab I", | |
| "Natural Science with Lab II", | |
| "MATH 167 β Business Mathematics", | |
| "MATH 267 β Business Calculus I", | |
| "ECON 202 β Principles of Microeconomics", | |
| "Humanities (3 hrs)", | |
| "Fine Arts (3 hrs)", | |
| "Humanities or Fine Arts β Additional (3 hrs)", | |
| ], | |
| "Additional Core Requirements": [ | |
| "ACCY 201 β Principles of Accounting I", | |
| "ACCY 202 β Principles of Accounting II", | |
| "ECON 203 β Principles of Macroeconomics", | |
| "BUS 250 β Legal Environment of Business", | |
| "BUS 271 / SPCH 102 / SPCH 105 β Business Communication or Speech", | |
| "BUS 230 / ECON 230 β Economic Statistics I", | |
| "ACCY 302 β Fundamentals of Data Analytics", | |
| ], | |
| "Major Course Requirements": [ | |
| "ACCY 303 β Financial Accounting I", | |
| "ACCY 304 β Financial Accounting II", | |
| "ACCY 309 β Cost Accounting", | |
| "ACCY 310 β Systems", | |
| "ACCY 401 β Auditing", | |
| "ACCY 402 β Advanced Accounting", | |
| "ACCY 405 β Income Tax", | |
| "ACCY 407 β Governmental Accounting", | |
| "ACCY 411 β Business Law", | |
| ], | |
| "Business Core & Other Requirements": [ | |
| "ACCY 520 β Internship OR MGMT 493 β Strategic Planning", | |
| "MKTG 351 β Marketing Principles", | |
| "BUS/ECON 302 β Economic Statistics II", | |
| "FIN 331 β Business Finance I", | |
| "MKTG 372 β Intro to Operations & Supply Chain Management", | |
| "MGMT 371 β Principles of Management", | |
| "MIS 309 β Management Information Systems", | |
| "WRIT 440 β Writing for Accountancy", | |
| ], | |
| "Minor Requirements": [ | |
| "Minor Course 1 (3 hrs)", | |
| "Minor Course 2 (3 hrs)", | |
| "Minor Course 3 (3 hrs)", | |
| ], | |
| }, | |
| "Banking and Finance (B.B.A.)": { | |
| "General Education Requirements": [ | |
| "WRIT 100/101 β First Year Writing I", | |
| "WRIT/LIBA 102 β First Year Writing II", | |
| "Humanities I (3 hrs)", | |
| "Humanities II (3 hrs)", | |
| "Fine Arts (3 hrs)", | |
| "Natural Science with Lab I", | |
| "Natural Science with Lab II", | |
| "MATH 167 β Business Mathematics", | |
| "MATH 267 β Business Calculus I", | |
| "ECON 202 β Principles of Microeconomics", | |
| "ECON 203 β Principles of Macroeconomics", | |
| ], | |
| "B.B.A. Core Requirements": [ | |
| "ACCY 201 β Accounting I", | |
| "ACCY 202 β Accounting II", | |
| "BUS 250 β Legal Environment of Business", | |
| "BUS 271 β Business Communication", | |
| "BUS/ECON 230 β Economic Statistics I", | |
| "MKTG 351 β Principles of Marketing", | |
| "FIN 331 β Principles of Finance", | |
| "MGMT 371 β Principles of Management", | |
| "ECON/BUS 302 β Economic Statistics II", | |
| "MKTG 372 β Intro to Operations and Supply Chain Management", | |
| "BAIS 309 β Business Analytics and Information Systems", | |
| "MGMT 493 β Management of Strategic Planning", | |
| "MKTG 354 β Professional Selling and Relationship Marketing", | |
| "300+ Elective (3 hrs)", | |
| "300+ Business Elective (3 hrs)", | |
| ], | |
| "Major Requirements": [ | |
| "ECON/FIN 303 β Money and Banking OR FIN 333 β Financial Markets & Institutions", | |
| "FIN 334 β Investments", | |
| "FIN 338 β Intermediate Finance Management", | |
| "FIN 537 β Banking and Finance I", | |
| "FIN 538 β Banking and Finance II", | |
| "Finance Major Elective I (3 hrs)", | |
| "Finance Major Elective II (3 hrs)", | |
| "Finance Major Elective III (3 hrs)", | |
| ], | |
| }, | |
| "Business Analytics & Information Systems (B.B.A.)": { | |
| "General Education Requirements": [ | |
| "WRIT 100/101 β First Year Writing I", | |
| "WRIT/LIBA 102 β First Year Writing II", | |
| "Humanities I (3 hrs)", | |
| "Humanities II (3 hrs)", | |
| "Fine Arts (3 hrs)", | |
| "Natural Science with Lab I", | |
| "Natural Science with Lab II", | |
| "MATH 167 β Business Mathematics", | |
| "MATH 267 β Business Calculus I", | |
| "ECON 202 β Principles of Microeconomics", | |
| "ECON 203 β Principles of Macroeconomics", | |
| ], | |
| "B.B.A. Core Requirements": [ | |
| "ACCY 201 β Accounting I", | |
| "ACCY 202 β Accounting II", | |
| "BUS 250 β Legal Environment of Business", | |
| "BUS 271 β Business Communication", | |
| "BUS/ECON 230 β Economic Statistics I", | |
| "MKTG 351 β Principles of Marketing", | |
| "FIN 331 β Principles of Finance", | |
| "MGMT 371 β Principles of Management", | |
| "ECON/BUS 302 β Economic Statistics II", | |
| "MKTG 372 β Intro to Operations and Supply Chain Management", | |
| "BAIS 309 β Business Analytics and Information Systems", | |
| "MGMT 493 β Management of Strategic Planning", | |
| "300+ Elective (3 hrs)", | |
| "300+ Business Elective I (3 hrs)", | |
| "300+ Business Elective II (3 hrs)", | |
| ], | |
| "Major Requirements": [ | |
| "BAIS Major Elective I (3 hrs)", | |
| "BAIS Major Elective II (3 hrs)", | |
| "BAIS Major Elective III (3 hrs)", | |
| "BAIS Major Elective IV (3 hrs)", | |
| "BAIS Major Elective V (3 hrs)", | |
| "BAIS Major Elective VI (3 hrs)", | |
| "BAIS Major Elective VII (3 hrs)", | |
| "BAIS Major Elective VIII (3 hrs)", | |
| ], | |
| }, | |
| } | |
| # ββ Session state init βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| if "selected_major" not in st.session_state: | |
| st.session_state.selected_major = None | |
| if "completed" not in st.session_state: | |
| st.session_state.completed = {} | |
| if "grades" not in st.session_state: | |
| st.session_state.grades = {} | |
| # ββ Header βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.markdown(""" | |
| <div class="hero"> | |
| <h1>π Ole Miss <span class="accent">Degree Planner</span></h1> | |
| <p>University of Mississippi Β· School of Business Β· Track your progress toward graduation</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # ββ Major Selection ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| col_sel, col_info = st.columns([2, 1]) | |
| with col_sel: | |
| major_choice = st.selectbox( | |
| "Select Your Major", | |
| options=["β Choose a major β"] + list(MAJORS.keys()), | |
| key="major_dropdown" | |
| ) | |
| if major_choice == "β Choose a major β": | |
| st.info("π Select your major above to get started.") | |
| st.stop() | |
| # Reset completed/grades when major changes | |
| if st.session_state.selected_major != major_choice: | |
| st.session_state.selected_major = major_choice | |
| st.session_state.completed = {} | |
| st.session_state.grades = {} | |
| major_data = MAJORS[major_choice] | |
| all_courses = [c for cats in major_data.values() for c in cats] | |
| # Quick stats | |
| total_courses = len(all_courses) | |
| completed_keys = [k for k, v in st.session_state.completed.items() if v] | |
| num_done = len(completed_keys) | |
| num_remaining = total_courses - num_done | |
| hrs_done = num_done * 3 | |
| hrs_remaining = num_remaining * 3 | |
| with col_info: | |
| st.markdown(f""" | |
| <div class="stat-box" style="margin-top:1.6rem;"> | |
| <div class="stat-num">{num_done}/{total_courses}</div> | |
| <div class="stat-lbl">Courses Completed</div> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # ββ Tabs βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| tab1, tab2, tab3 = st.tabs(["π Course Checklist", "π Remaining Courses", "π GPA Calculator"]) | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # TAB 1 β CHECKLIST | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| with tab1: | |
| st.markdown("**Check off every course you have already completed. Then enter your grade.**") | |
| st.markdown('<hr class="divider">', unsafe_allow_html=True) | |
| for category, courses in major_data.items(): | |
| cat_done = sum(1 for c in courses if st.session_state.completed.get(c, False)) | |
| cat_total = len(courses) | |
| st.markdown(f""" | |
| <div class="card-header"> | |
| {category} | |
| <span class="badge-done">{cat_done} done</span> | |
| <span class="badge-remaining">{cat_total - cat_done} left</span> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| for course in courses: | |
| c1, c2 = st.columns([3, 1]) | |
| with c1: | |
| checked = st.checkbox( | |
| course, | |
| key=f"chk_{course}", | |
| value=st.session_state.completed.get(course, False) | |
| ) | |
| st.session_state.completed[course] = checked | |
| with c2: | |
| if checked: | |
| grade = st.selectbox( | |
| "Grade", | |
| options=list(GRADE_MAP.keys()), | |
| key=f"grade_{course}", | |
| index=list(GRADE_MAP.keys()).index( | |
| st.session_state.grades.get(course, "A") | |
| ), | |
| label_visibility="collapsed" | |
| ) | |
| st.session_state.grades[course] = grade | |
| st.markdown("<br>", unsafe_allow_html=True) | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # TAB 2 β REMAINING COURSES | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| with tab2: | |
| remaining_by_cat = {} | |
| done_by_cat = {} | |
| for category, courses in major_data.items(): | |
| rem = [c for c in courses if not st.session_state.completed.get(c, False)] | |
| done = [c for c in courses if st.session_state.completed.get(c, False)] | |
| remaining_by_cat[category] = rem | |
| done_by_cat[category] = done | |
| total_rem = sum(len(v) for v in remaining_by_cat.values()) | |
| if total_rem == 0: | |
| st.success("π Congratulations! You've completed all course requirements for this major!") | |
| else: | |
| st.markdown(f"You have **{total_rem} courses** ({total_rem * 3} credit hours) remaining.") | |
| st.markdown('<hr class="divider">', unsafe_allow_html=True) | |
| for category, rem_courses in remaining_by_cat.items(): | |
| done_courses = done_by_cat[category] | |
| if not rem_courses and not done_courses: | |
| continue | |
| st.markdown(f""" | |
| <div class="card-header"> | |
| {category} | |
| <span class="badge-remaining">{len(rem_courses)} remaining</span> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| pills_html = "" | |
| for c in rem_courses: | |
| pills_html += f'<span class="course-pill">{c}</span>' | |
| for c in done_courses: | |
| pills_html += f'<span class="course-pill done">β {c}</span>' | |
| st.markdown(pills_html, unsafe_allow_html=True) | |
| st.markdown("<br>", unsafe_allow_html=True) | |
| # Summary stats row | |
| c1, c2, c3 = st.columns(3) | |
| c1.markdown(f'<div class="stat-box"><div class="stat-num">{num_done}</div><div class="stat-lbl">Completed</div></div>', unsafe_allow_html=True) | |
| c2.markdown(f'<div class="stat-box"><div class="stat-num">{total_rem}</div><div class="stat-lbl">Remaining</div></div>', unsafe_allow_html=True) | |
| c3.markdown(f'<div class="stat-box"><div class="stat-num">{total_rem * 3}</div><div class="stat-lbl">Hours Left</div></div>', unsafe_allow_html=True) | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # TAB 3 β GPA CALCULATOR | |
| # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| with tab3: | |
| graded_courses = [ | |
| c for c in completed_keys | |
| if st.session_state.grades.get(c) in GRADE_MAP | |
| and GRADE_MAP[st.session_state.grades.get(c)] is not None | |
| ] | |
| if not graded_courses: | |
| st.info("βοΈ Complete courses and enter grades in the **Course Checklist** tab to see your GPA here.") | |
| else: | |
| total_points = sum(GRADE_MAP[st.session_state.grades[c]] for c in graded_courses) | |
| gpa = total_points / len(graded_courses) | |
| # GPA color | |
| if gpa >= 3.5: | |
| gpa_status = "Dean's List π" | |
| elif gpa >= 3.0: | |
| gpa_status = "Good Standing π" | |
| elif gpa >= 2.0: | |
| gpa_status = "Satisfactory β" | |
| else: | |
| gpa_status = "Below Minimum β οΈ" | |
| col_gpa, col_breakdown = st.columns([1, 2]) | |
| with col_gpa: | |
| st.markdown(f""" | |
| <div class="gpa-badge"> | |
| <div class="gpa-number">{gpa:.2f}</div> | |
| <div class="gpa-label">Cumulative GPA</div> | |
| <div style="color:var(--gold); font-size:0.9rem; margin-top:0.5rem; font-weight:600;">{gpa_status}</div> | |
| <div style="color:rgba(255,255,255,0.6); font-size:0.75rem; margin-top:0.3rem;">Based on {len(graded_courses)} graded course(s)</div> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| with col_breakdown: | |
| st.markdown('<div class="card-header">Grade Breakdown</div>', unsafe_allow_html=True) | |
| grade_counts = {} | |
| for c in graded_courses: | |
| g = st.session_state.grades[c] | |
| grade_counts[g] = grade_counts.get(g, 0) + 1 | |
| for grade, count in sorted(grade_counts.items()): | |
| pct = count / len(graded_courses) | |
| bar_color = {"A": "#16A34A", "B": "#2563EB", "C": "#D97706", "D": "#EA580C", "F": "#DC2626"}.get(grade, "#6B7280") | |
| st.markdown(f""" | |
| <div style="display:flex; align-items:center; gap:0.75rem; margin-bottom:0.5rem;"> | |
| <span style="width:1.5rem; font-weight:700; color:var(--navy);">{grade}</span> | |
| <div style="flex:1; background:#E5E7EB; border-radius:99px; height:12px; overflow:hidden;"> | |
| <div style="width:{pct*100:.0f}%; background:{bar_color}; height:100%; border-radius:99px;"></div> | |
| </div> | |
| <span style="font-size:0.85rem; color:var(--muted);">{count} course(s)</span> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.markdown('<hr class="divider">', unsafe_allow_html=True) | |
| st.markdown("**Course-by-Course Detail**") | |
| for c in graded_courses: | |
| g = st.session_state.grades[c] | |
| pts = GRADE_MAP[g] | |
| st.markdown(f""" | |
| <div style="display:flex; justify-content:space-between; padding:0.25rem 0; border-bottom:1px solid var(--border); font-size:0.85rem;"> | |
| <span style="color:var(--text);">{c}</span> | |
| <span style="font-weight:700; color:var(--navy);">{g} ({pts:.1f})</span> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.markdown("<br>", unsafe_allow_html=True) | |
| st.markdown(""" | |
| <div style="background:#FEF3C7; border:1px solid #F59E0B; border-radius:8px; padding:0.75rem 1rem; font-size:0.82rem; color:#92400E;"> | |
| β οΈ <strong>Note:</strong> A minimum 2.0 GPA is required for graduation. All 300+ level courses must be taken in residence at UM. | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # ββ Footer βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.markdown('<hr class="divider">', unsafe_allow_html=True) | |
| st.markdown(""" | |
| <div style="text-align:center; color:#9CA3AF; font-size:0.78rem; padding:0.5rem 0;"> | |
| University of Mississippi Β· School of Business Administration Β· Degree requirements effective Fall 2025 β Summer 2026<br> | |
| Always verify requirements with your academic advisor. | |
| </div> | |
| """, unsafe_allow_html=True) | |