Spaces:
Sleeping
Sleeping
| """ | |
| AI-Powered Marketing Automation & Lead Generation for SMEs | |
| Main entry-point / Home page | |
| """ | |
| import streamlit as st | |
| from utils.helpers import PHASE_DESCRIPTIONS, load_leads, load_bank | |
| st.set_page_config( | |
| page_title="AI Marketing Automation β SME", | |
| page_icon="π", | |
| layout="wide", | |
| initial_sidebar_state="expanded", | |
| ) | |
| # ββ Custom CSS ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.markdown(""" | |
| <style> | |
| .hero { background: linear-gradient(135deg, #1e3a5f 0%, #2d6a9f 100%); | |
| padding: 2.5rem 2rem; border-radius: 12px; margin-bottom: 1.5rem; color: white; } | |
| .hero h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 0.4rem; } | |
| .hero p { font-size: 1.05rem; opacity: 0.9; } | |
| .phase-card { background: #f8faff; border: 1px solid #d1e0f5; | |
| border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 0.6rem; | |
| transition: box-shadow .2s; } | |
| .phase-card:hover { box-shadow: 0 4px 14px rgba(45,106,159,.15); } | |
| .phase-num { font-size: 1.7rem; font-weight: 800; color: #2d6a9f; } | |
| .phase-title { font-size: 1rem; font-weight: 700; color: #1e3a5f; } | |
| .phase-desc { font-size: 0.85rem; color: #555; } | |
| .stat-box { background: #fff; border: 1px solid #e0e8f0; border-radius: 8px; | |
| padding: 1rem; text-align: center; } | |
| .stat-val { font-size: 1.8rem; font-weight: 800; color: #2d6a9f; } | |
| .stat-lbl { font-size: 0.8rem; color: #666; } | |
| [data-testid="stSidebar"] { background: #1e3a5f; } | |
| [data-testid="stSidebar"] * { color: #e8f0ff !important; } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # ββ Hero Banner βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.markdown(""" | |
| <div class="hero"> | |
| <h1>π AI-Powered Marketing Automation</h1> | |
| <p>Lead Generation & Scoring Framework for Small and Medium Enterprises (SMEs)<br> | |
| <em>Bank Marketing Dataset (UCI) | Lead Scoring Dataset (Kaggle)</em></p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # ββ Quick dataset stats βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| with st.spinner("Loading datasetsβ¦"): | |
| leads = load_leads() | |
| bank = load_bank() | |
| c1, c2, c3, c4, c5, c6 = st.columns(6) | |
| stats = [ | |
| (f"{len(leads):,}", "Lead Records"), | |
| (f"{leads.shape[1]}", "Lead Features"), | |
| (f"{leads['Converted'].mean()*100:.1f}%", "Lead Conv. Rate"), | |
| (f"{len(bank):,}", "Bank Records"), | |
| (f"{bank.shape[1]}", "Bank Features"), | |
| (f"{(bank['y']=='yes').mean()*100:.1f}%", "Bank Sub. Rate"), | |
| ] | |
| for col, (val, lbl) in zip([c1,c2,c3,c4,c5,c6], stats): | |
| col.markdown(f'<div class="stat-box"><div class="stat-val">{val}</div>' | |
| f'<div class="stat-lbl">{lbl}</div></div>', unsafe_allow_html=True) | |
| st.markdown("---") | |
| # ββ Phase Overview ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.markdown("### π Implementation Phases") | |
| st.markdown("Navigate through each phase using the **sidebar** on the left.") | |
| cols = st.columns(3) | |
| for idx, (phase_num, (title, desc)) in enumerate(PHASE_DESCRIPTIONS.items()): | |
| with cols[idx % 3]: | |
| st.markdown( | |
| f'<div class="phase-card">' | |
| f'<span class="phase-num">Phase {phase_num}</span><br>' | |
| f'<span class="phase-title">{title}</span><br>' | |
| f'<span class="phase-desc">{desc}</span>' | |
| f'</div>', | |
| unsafe_allow_html=True, | |
| ) | |
| st.markdown("---") | |
| # ββ Research Goals Summary ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| with st.expander("π Research Goals & Background"): | |
| st.markdown(""" | |
| **This system implements the research framework from:** | |
| > *AI-Powered Marketing Automation and Lead Generation for SMEs* | |
| #### Key Research Goals | |
| | Goal | Description | | |
| |------|-------------| | |
| | **G1 β Integrated AI Framework** | Combine classification, NLP, and conversational AI | | |
| | **G2 β Lead Scoring** | Evaluate LR, RF, XGBoost, LightGBM, SVM, MLP | | |
| | **G3 β Empirical Validation** | Benchmark on Kaggle Leads (~9k) & UCI Bank (~45k) | | |
| | **G4 β NLP Effectiveness** | Intent, sentiment, engagement signal extraction | | |
| | **G5 β Conversational AI** | Chatbot for 24/7 lead qualification | | |
| | **G6 β Ethics & Privacy** | Bias detection, GDPR compliance, explainability | | |
| | **G7 β ROI Analysis** | Quantify conversion uplift and cost savings | | |
| #### Datasets | |
| - **Leads Dataset** β EdTech platform, ~9,240 records, 37 features, 38.5% conversion rate | |
| - **Bank Marketing Dataset** β Portuguese bank, ~45,211 records, 17 features, 11.7% subscription rate | |
| """) | |
| st.info("π **Use the sidebar to navigate between phases.** Start with **Phase 1 β Data Loading**.") | |