cryogenic22 commited on
Commit
dd843bb
Β·
verified Β·
1 Parent(s): e3dc306

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -57
app.py CHANGED
@@ -1,69 +1,43 @@
1
  import streamlit as st
 
 
2
  from src.components.learning_paths import LearningPaths
3
-
4
- def init_session_state():
5
- """Initialize session state variables"""
6
- if 'completed_modules' not in st.session_state:
7
- st.session_state.completed_modules = []
8
 
9
  def main():
10
- st.set_page_config(
11
- page_title="EduAI Platform",
12
- page_icon="πŸŽ“",
13
- layout="wide"
14
- )
15
 
16
- init_session_state()
 
17
 
18
- # Title and welcome
19
- st.title("πŸŽ“ EduAI Platform")
20
 
21
- # Sidebar user management
22
- with st.sidebar:
23
- st.header("πŸ‘€ Profile")
24
- if 'username' not in st.session_state:
25
- username = st.text_input("Enter your nickname")
26
- if username:
27
- st.session_state.username = username
28
- # Initialize learning paths and load progress
29
- learning_paths = LearningPaths()
30
- learning_paths.load_user_progress(username)
31
- else:
32
- st.write(f"Welcome back, {st.session_state.username}! πŸ‘‹")
33
- if st.button("Sign Out"):
34
- for key in st.session_state.keys():
35
- del st.session_state[key]
36
- st.rerun()
37
 
38
- # Main content
39
- if 'username' in st.session_state:
40
- tab1, tab2 = st.tabs(["πŸ“š Learning Paths", "πŸ† Progress"])
41
-
42
- with tab1:
43
- learning_paths = LearningPaths()
44
- learning_paths.display()
45
-
46
- with tab2:
47
- st.header("Your Learning Progress")
48
- # Display completed modules
49
- if st.session_state.completed_modules:
50
- st.write(f"Completed modules: {len(st.session_state.completed_modules)}")
51
- for module_id in st.session_state.completed_modules:
52
- st.success(f"βœ… {module_id}")
53
- else:
54
- st.info("Start learning to track your progress!")
55
- else:
56
  st.info("πŸ‘‹ Welcome to EduAI Platform! Please enter your nickname to start learning.")
57
-
58
- # Show platform features
59
- st.markdown("""
60
- ### Platform Features
61
- - πŸ“š Structured Learning Paths
62
- - πŸ€– AI-Generated Content
63
- - πŸ’» Interactive Quizzes
64
- - πŸ“Š Progress Tracking
65
- - πŸ† Achievements
66
- """)
 
 
 
 
67
 
68
  if __name__ == "__main__":
69
  main()
 
1
  import streamlit as st
2
+ from src.components.ai_tutor import AITutor
3
+ from src.components.code_playground import CodePlayground
4
  from src.components.learning_paths import LearningPaths
5
+ from src.components.sidebar import Sidebar
6
+ from src.utils.session import initialize_session_state
7
+ from src.utils.ui import set_page_config, apply_custom_css
 
 
8
 
9
  def main():
10
+ # Initialize app
11
+ set_page_config()
12
+ apply_custom_css()
13
+ initialize_session_state()
 
14
 
15
+ # Initialize components
16
+ ai_tutor = AITutor()
17
 
18
+ # Display sidebar
19
+ Sidebar.display()
20
 
21
+ # Title
22
+ st.title("πŸŽ“ EduAI Platform")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ # Welcome message for new users
25
+ if 'username' not in st.session_state:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  st.info("πŸ‘‹ Welcome to EduAI Platform! Please enter your nickname to start learning.")
27
+ return
28
+
29
+ # Main content tabs
30
+ tab1, tab2, tab3 = st.tabs(["πŸ“š Learning Paths", "πŸ€– AI Tutor", "πŸ’» Code Playground"])
31
+
32
+ with tab1:
33
+ LearningPaths.display()
34
+
35
+ with tab2:
36
+ ai_tutor.display_chat_interface()
37
+ ai_tutor.display_learning_metrics()
38
+
39
+ with tab3:
40
+ CodePlayground.display()
41
 
42
  if __name__ == "__main__":
43
  main()