Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,69 +1,43 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
from src.components.learning_paths import LearningPaths
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
if 'completed_modules' not in st.session_state:
|
| 7 |
-
st.session_state.completed_modules = []
|
| 8 |
|
| 9 |
def main():
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
)
|
| 15 |
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 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 |
-
#
|
| 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 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 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()
|