cryogenic22 commited on
Commit
bc1abf3
·
verified ·
1 Parent(s): 66e9fea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -2
app.py CHANGED
@@ -53,6 +53,21 @@ st.markdown("""
53
  background: #4caf50;
54
  transition: width 0.5s ease-in-out;
55
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  </style>
57
  """, unsafe_allow_html=True)
58
 
@@ -85,6 +100,9 @@ def display_progress_bar():
85
  if st.session_state.learning_path:
86
  path = st.session_state.learning_path
87
  total_modules = len(path.modules)
 
 
 
88
  current = st.session_state.current_module + 1
89
  progress = (current / total_modules) * 100
90
 
@@ -186,8 +204,12 @@ def create_new_course():
186
 
187
  path = asyncio.run(create_course())
188
  st.session_state.learning_path = path
189
- st.success("🎉 Your course is ready! Modules are being generated.")
190
- st.rerun()
 
 
 
 
191
  except Exception as e:
192
  st.error(f"Error: {str(e)}")
193
 
@@ -213,6 +235,9 @@ def main():
213
  def display_current_course():
214
  """Display current course content"""
215
  path = st.session_state.learning_path
 
 
 
216
  display_learning_roadmap()
217
  display_progress_bar()
218
 
 
53
  background: #4caf50;
54
  transition: width 0.5s ease-in-out;
55
  }
56
+ .alert {
57
+ position: relative;
58
+ padding: 20px;
59
+ margin-bottom: 20px;
60
+ border-radius: 8px;
61
+ border: 1px solid #4caf50;
62
+ background-color: #dff0d8;
63
+ }
64
+ .alert .close {
65
+ position: absolute;
66
+ top: 10px;
67
+ right: 10px;
68
+ cursor: pointer;
69
+ font-size: 1.5em;
70
+ }
71
  </style>
72
  """, unsafe_allow_html=True)
73
 
 
100
  if st.session_state.learning_path:
101
  path = st.session_state.learning_path
102
  total_modules = len(path.modules)
103
+ if total_modules == 0:
104
+ st.warning("No modules available in the course.")
105
+ return
106
  current = st.session_state.current_module + 1
107
  progress = (current / total_modules) * 100
108
 
 
204
 
205
  path = asyncio.run(create_course())
206
  st.session_state.learning_path = path
207
+ st.markdown("""
208
+ <div class="alert">
209
+ 🎉 Your course is ready! Modules are being generated.
210
+ <span class="close" onclick="this.parentElement.style.display='none';">&times;</span>
211
+ </div>
212
+ """, unsafe_allow_html=True)
213
  except Exception as e:
214
  st.error(f"Error: {str(e)}")
215
 
 
235
  def display_current_course():
236
  """Display current course content"""
237
  path = st.session_state.learning_path
238
+ if not path or len(path.modules) == 0:
239
+ st.warning("No modules are available yet. Please wait for the course generation to complete.")
240
+ return
241
  display_learning_roadmap()
242
  display_progress_bar()
243