diff --git a/app.py b/app.py index 5e70a8b..5c969cd 100644 --- a/app.py +++ b/app.py @@ -99,7 +99,7 @@ def get_all_predictions(self, predictions): from models.navigation import top_navigation_bar except ImportError: def top_navigation_bar(): - st.error("Navigation component not found") + pass # Silent fallback # --- Session State Initialization --- # Initialize all session state variables @@ -524,11 +524,26 @@ def navigate_to(page_name): transform: translateY(-1px) !important; } - /* Sidebar hover effects */ + /* Sidebar hover effects and scrolling fix */ .stSidebar > div:hover { box-shadow: 0 4px 12px var(--hover-shadow) !important; } + /* Ensure sidebar can scroll properly */ + .stSidebar { + overflow-y: auto !important; + overflow-x: hidden !important; + position: relative !important; + z-index: 999 !important; + } + + .stSidebar > div { + overflow-y: auto !important; + overflow-x: hidden !important; + height: 100vh !important; + max-height: 100vh !important; + } + /* Progress bar hover effects */ .stProgress > div:hover { box-shadow: 0 0 10px var(--hover-glow) !important; @@ -565,9 +580,117 @@ def navigate_to(page_name): transform: translateY(-1px) !important; box-shadow: 0 4px 12px var(--hover-shadow) !important; } + + /* Minimal fix for overlapping issues - only for dashboard elements */ + .stTooltip { + z-index: 9999 !important; + position: fixed !important; + } + + /* Fix only dashboard-specific elements */ + .metric-container { + position: relative !important; + z-index: 1 !important; + margin: 10px 0 !important; + } + + /* Fix column layout for dashboard cards */ + .stColumns { + display: flex !important; + flex-wrap: wrap !important; + gap: 10px !important; + margin: 0 !important; + padding: 0 !important; + } + + .stColumns > div { + flex: 1 !important; + min-width: 0 !important; + margin: 0 !important; + padding: 0 !important; + } + + /* Dashboard container fixes */ + .dashboard-content { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + } + + .dashboard-tabs-container { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + } + + .dashboard-tab-content { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + padding: 10px 0 !important; + } + + /* Smooth scrolling for navigation */ + html { + scroll-behavior: smooth !important; + } + + /* Content sections for navigation */ + .content-section { + scroll-margin-top: 100px !important; + padding: 20px 0 !important; + } + + /* Navigation button scroll effects */ + .nav-scroll-button { + transition: all 0.3s ease !important; + cursor: pointer !important; + } + + .nav-scroll-button:hover { + transform: translateY(-2px) !important; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important; + } + + /* Active button styling */ + .stButton > button:active, + .stButton > button:focus { + background-color: #4ecdc4 !important; + color: #ffffff !important; + border: 2px solid #4ecdc4 !important; + box-shadow: 0 0 10px rgba(78, 205, 196, 0.5) !important; + } + + /* Clicked button styling */ + .nav-button-clicked { + background-color: #4ecdc4 !important; + color: #ffffff !important; + border: 2px solid #4ecdc4 !important; + box-shadow: 0 0 10px rgba(78, 205, 196, 0.5) !important; + } """, unsafe_allow_html=True) +# Add JavaScript for button click styling +st.markdown(""" + +""", unsafe_allow_html=True) + + + # --- Page Functions --- def show_home_page(): """Beautiful and comprehensive home page""" @@ -817,7 +940,7 @@ def show_home_page(): # Feedback Section st.markdown("---") st.markdown(""" -
+

đŸ’Ŧ Your Feedback Matters!

@@ -6652,6 +6775,38 @@ def update_progress(progress, message=""): .main, .stApp { background: #181f2f; } + + /* Sidebar dark mode styling */ + .stSidebar { + background: #232a3d !important; + color: #f8fafc !important; + } + + .stSidebar .stMarkdown { + color: #f8fafc !important; + } + + .stSidebar label { + color: #f8fafc !important; + } + + .stSidebar .stExpander { + background: #232a3d !important; + border: 1px solid #324a7c !important; + } + + .stSidebar .stCheckbox label { + color: #f8fafc !important; + } + + .stSidebar .stRadio label { + color: #f8fafc !important; + } + + .stSidebar .stSelectbox label { + color: #f8fafc !important; + } + .metric-container, .prediction-card, .ensemble-card, .feature-card, .model-info, .ensemble-method, .method-comparison { background: #232a3d; border-radius: 16px; @@ -6716,6 +6871,166 @@ def update_progress(progress, message=""): .main, .stApp { background: #f4f8ff; } + + /* Sidebar light mode styling */ + .stSidebar { + background: #ffffff !important; + color: #232a3d !important; + } + + .stSidebar .stMarkdown { + color: #232a3d !important; + } + + .stSidebar label { + color: #232a3d !important; + } + + .stSidebar .stExpander { + background: #ffffff !important; + border: 1px solid #b3c7f7 !important; + } + + .stSidebar .stCheckbox label { + color: #232a3d !important; + } + + .stSidebar .stRadio label { + color: #232a3d !important; + } + + .stSidebar .stSelectbox label { + color: #232a3d !important; + } + + /* Additional sidebar elements for light mode */ + .stSidebar .stText { + color: #232a3d !important; + } + + .stSidebar .stMetric { + color: #232a3d !important; + } + + .stSidebar .stSelectbox > div > div { + background: #ffffff !important; + color: #232a3d !important; + border: 1px solid #b3c7f7 !important; + } + + .stSidebar .stSelectbox > div > div > div { + background: #ffffff !important; + color: #232a3d !important; + } + + .stSidebar .stCheckbox > div > label { + color: #232a3d !important; + } + + .stSidebar .stRadio > div > label { + color: #232a3d !important; + } + + .stSidebar .stNumberInput label { + color: #232a3d !important; + } + + .stSidebar .stSlider label { + color: #232a3d !important; + } + + .stSidebar .stProgress label { + color: #232a3d !important; + } + + .stSidebar .stInfo { + color: #232a3d !important; + } + + .stSidebar .stSuccess { + color: #232a3d !important; + } + + .stSidebar .stWarning { + color: #232a3d !important; + } + + .stSidebar .stError { + color: #232a3d !important; + } + + /* Force sidebar text visibility in light mode */ + .stSidebar * { + color: #232a3d !important; + } + + .stSidebar div { + color: #232a3d !important; + } + + .stSidebar span { + color: #232a3d !important; + } + + .stSidebar p { + color: #232a3d !important; + } + + .stSidebar h1, .stSidebar h2, .stSidebar h3, .stSidebar h4, .stSidebar h5, .stSidebar h6 { + color: #232a3d !important; + } + + /* Specific targeting for Streamlit components */ + .stSidebar [data-testid="stCheckbox"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stRadio"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stSelectbox"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stExpander"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stText"] { + color: #232a3d !important; + } + + .stSidebar [data-testid="stMetric"] { + color: #232a3d !important; + } + + /* Override any inherited light colors */ + .stSidebar .stMarkdown p { + color: #232a3d !important; + } + + .stSidebar .stMarkdown div { + color: #232a3d !important; + } + + .stSidebar .stMarkdown span { + color: #232a3d !important; + } + + /* Ensure form elements are visible */ + .stSidebar .stForm label { + color: #232a3d !important; + } + + .stSidebar .stForm div { + color: #232a3d !important; + } + + .stSidebar .stForm span { + color: #232a3d !important; + } + .metric-container, .prediction-card, .ensemble-card, .feature-card, .model-info, .ensemble-method, .method-comparison { background: #e3eafc; border-radius: 16px; @@ -6787,7 +7102,7 @@ def render_spamlyser_dashboard(): st.markdown("---") st.markdown(""" -
+

📊 Advanced Analytics Dashboard

@@ -6797,28 +7112,52 @@ def render_spamlyser_dashboard():
""", unsafe_allow_html=True) - # Dashboard tabs - # Dashboard tabs + # Dashboard tabs with proper container + st.markdown('
', unsafe_allow_html=True) + dashboard_tabs = st.tabs(["đŸŽ¯ Overview", "🤖 Model Performance", "🧠 Ensemble Analytics", "📊 Detailed Stats", "⚡ Real-time Monitor"]) with dashboard_tabs[0]: # Overview Tab + st.markdown('
', unsafe_allow_html=True) render_overview_dashboard() + st.markdown('
', unsafe_allow_html=True) with dashboard_tabs[1]: # Model Performance Tab + st.markdown('
', unsafe_allow_html=True) render_model_performance_dashboard() + st.markdown('
', unsafe_allow_html=True) with dashboard_tabs[2]: # Ensemble Analytics Tab + st.markdown('
', unsafe_allow_html=True) render_ensemble_dashboard() + st.markdown('
', unsafe_allow_html=True) with dashboard_tabs[3]: # Detailed Stats Tab + st.markdown('
', unsafe_allow_html=True) render_detailed_stats_dashboard() + st.markdown('
', unsafe_allow_html=True) with dashboard_tabs[4]: # Real-time Monitor Tab + st.markdown('
', unsafe_allow_html=True) render_realtime_monitor() + st.markdown('
', unsafe_allow_html=True) + + st.markdown('
', unsafe_allow_html=True) def render_overview_dashboard(): st.markdown(""" """, unsafe_allow_html=True) @@ -7427,7 +7778,7 @@ def render_realtime_monitor(): # Add this to your main app.py file after your existing analysis section: # --- ADD THE DASHBOARD SECTION --- -if st.sidebar.button("📊 Open Dashboard", key="open_dashboard", help="Open the advanced analytics dashboard"): +if st.sidebar.button("📊 Open Dashboard", key="open_dashboard"): st.session_state.show_dashboard = True if st.session_state.get('show_dashboard', False): @@ -8627,39 +8978,52 @@ def classify_csv(file, ensemble_mode, selected_models_for_bulk, selected_ensembl """, unsafe_allow_html=True) + # Create beautiful navigation links in columns col1, col2, col3, col4, col5 = st.columns(5) with col1: - if st.button("🏠 Home", key="nav_home", use_container_width=True): + if st.button("Home", key="nav_home", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('home') - if st.button("â„šī¸ About", key="nav_about", use_container_width=True): + if st.button("About", key="nav_about", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('about') with col2: - if st.button("⚡ Features", key="nav_features", use_container_width=True): + if st.button("Features", key="nav_features", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('features') - if st.button("📊 Analytics", key="nav_analytics", use_container_width=True): + if st.button("Analytics", key="nav_analytics", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('analytics') with col3: - if st.button("🤖 Models", key="nav_models", use_container_width=True): + if st.button("Models", key="nav_models", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('models') - if st.button("đŸ’Ŧ Feedback", key="nav_feedback", use_container_width=True): + if st.button("Feedback", key="nav_feedback", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('feedback') with col4: - if st.button("📞 Contact", key="nav_contact", use_container_width=True): + if st.button("Contact", key="nav_contact", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('contact') - if st.button("📚 Docs", key="nav_docs", use_container_width=True): + if st.button("Docs", key="nav_docs", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('docs') with col5: - if st.button("🔌 API", key="nav_api", use_container_width=True): + if st.button("API", key="nav_api", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('api') - if st.button("âš™ī¸ Settings", key="nav_settings", use_container_width=True): + if st.button("Settings", key="nav_settings", use_container_width=True): + st.markdown('', unsafe_allow_html=True) navigate_to('settings') + + # Beautiful Footer Info Section # Clean and simple footer info st.markdown("---") @@ -8690,31 +9054,5 @@ def classify_csv(file, ensemble_mode, selected_models_for_bulk, selected_ensembl ) # --- Main Execution --- -# Route to appropriate page based on session state -if st.session_state.current_page == 'home': - show_home_page() -elif st.session_state.current_page == 'analyzer': - # All the above analyzer content has already been executed - pass -elif st.session_state.current_page == 'about': - show_about_page() -elif st.session_state.current_page == 'features': - show_features_page() -elif st.session_state.current_page == 'analytics': - show_analytics_page() -elif st.session_state.current_page == 'models': - show_models_page() -elif st.session_state.current_page == 'help': - show_help_page() -elif st.session_state.current_page == 'contact': - show_contact_page() -elif st.session_state.current_page == 'docs': - show_docs_page() -elif st.session_state.current_page == 'api': - show_api_page() -elif st.session_state.current_page == 'settings': - show_settings_page() -else: - # Default to home page - st.session_state.current_page = 'home' - show_home_page() +# Call the main function to handle routing +main() diff --git a/feedback_data.json b/feedback_data.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/feedback_data.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/models/__pycache__/__init__.cpython-314.pyc b/models/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..2da5998 Binary files /dev/null and b/models/__pycache__/__init__.cpython-314.pyc differ diff --git a/models/__pycache__/batch_processor.cpython-314.pyc b/models/__pycache__/batch_processor.cpython-314.pyc new file mode 100644 index 0000000..cfe08ba Binary files /dev/null and b/models/__pycache__/batch_processor.cpython-314.pyc differ diff --git a/models/__pycache__/ensemble_classifier_method.cpython-314.pyc b/models/__pycache__/ensemble_classifier_method.cpython-314.pyc new file mode 100644 index 0000000..5c13266 Binary files /dev/null and b/models/__pycache__/ensemble_classifier_method.cpython-314.pyc differ diff --git a/models/__pycache__/export_feature.cpython-314.pyc b/models/__pycache__/export_feature.cpython-314.pyc new file mode 100644 index 0000000..7c966a8 Binary files /dev/null and b/models/__pycache__/export_feature.cpython-314.pyc differ diff --git a/models/__pycache__/feedback_handler.cpython-314.pyc b/models/__pycache__/feedback_handler.cpython-314.pyc new file mode 100644 index 0000000..8eda583 Binary files /dev/null and b/models/__pycache__/feedback_handler.cpython-314.pyc differ diff --git a/models/__pycache__/model_init.cpython-314.pyc b/models/__pycache__/model_init.cpython-314.pyc new file mode 100644 index 0000000..5ee4068 Binary files /dev/null and b/models/__pycache__/model_init.cpython-314.pyc differ diff --git a/models/__pycache__/threat_analyzer.cpython-314.pyc b/models/__pycache__/threat_analyzer.cpython-314.pyc new file mode 100644 index 0000000..bc3be6f Binary files /dev/null and b/models/__pycache__/threat_analyzer.cpython-314.pyc differ diff --git a/models/__pycache__/word_analyzer.cpython-314.pyc b/models/__pycache__/word_analyzer.cpython-314.pyc new file mode 100644 index 0000000..bf864d5 Binary files /dev/null and b/models/__pycache__/word_analyzer.cpython-314.pyc differ