import streamlit as st import os import glob import sys import numpy as np import plotly.graph_objects as go from sklearn.linear_model import LinearRegression import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize # Add the current directory to the Python path sys.path.append(os.path.dirname(os.path.abspath(__file__))) # Import the login component from components.login import login # Import week pages from course_pages import week_1 from course_pages import week_2 from course_pages import week_3 from course_pages import week_4 from course_pages import week_5 from course_pages import week_6 from course_pages import week_7 from course_pages import week_8 from course_pages import week_9 # Page configuration st.set_page_config( page_title="Data Science Course App", page_icon="📚", layout="wide", initial_sidebar_state="expanded", menu_items={ 'Get Help': None, 'Report a bug': None, 'About': None } ) # Disable URL paths and hide Streamlit elements st.markdown(""" """, unsafe_allow_html=True) # Custom CSS def load_css(): try: with open('assets/style.css') as f: st.markdown(f'', unsafe_allow_html=True) except FileNotFoundError: # Fallback for Streamlit Cloud deployment st.markdown(""" """, unsafe_allow_html=True) # Initialize session state if 'current_week' not in st.session_state: st.session_state.current_week = 1 if 'logged_in' not in st.session_state: st.session_state.logged_in = False # Sidebar navigation def sidebar_navigation(): with st.sidebar: st.title("Course Navigation") # Show username if logged in if st.session_state.logged_in: st.write(f"Welcome, {st.session_state.username}!") # Debug button to show current week if st.session_state.username == "admin": if st.button("Debug: Show Current Week"): st.write(f"Current week: {st.session_state.current_week}") # Logout button if st.button("Logout"): st.session_state.logged_in = False st.session_state.username = None st.rerun() st.markdown("---") st.subheader("Course Content") # Create a container for week buttons week_container = st.container() # Add week buttons with custom styling with week_container: for week in range(1, 11): if st.button(f"Week {week}", key=f"week_{week}"): st.session_state.current_week = week st.rerun() def show_week_content(): # Debug print to show current week #st.write(f"Debug: Current week is {st.session_state.current_week}") if st.session_state.current_week == 1: week_1.show() elif st.session_state.current_week == 2: week_2.show() elif st.session_state.current_week == 3: week_3.show() elif st.session_state.current_week == 4: week_4.show() elif st.session_state.current_week == 5: week_5.show() elif st.session_state.current_week == 6: week_6.show() elif st.session_state.current_week == 7: week_7.show() elif st.session_state.current_week == 8: week_8.show() elif st.session_state.current_week == 9: week_9.show() else: st.warning("Content for this week is not yet available.") # Main content def main(): # Check if user is logged in if not st.session_state.logged_in: # Show login page login() return # User is logged in, show course content if st.session_state.current_week in [1, 2, 3, 4, 5, 6, 7, 8, 9]: show_week_content() else: st.title("Data Science Research Paper Course") st.markdown(""" ## Welcome to the Data Science Research Paper Course! 📚 This section has not been released yet. """) if __name__ == "__main__": load_css() sidebar_navigation() main()