Akshayram1 commited on
Commit
6c08b31
Β·
verified Β·
1 Parent(s): 2310555

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -164,17 +164,24 @@ if st.session_state.content_plan:
164
  for day in range(10):
165
  current_date = start_date + timedelta(days=day)
166
  with st.expander(f"Day {day+1} - {current_date.strftime('%b %d')}", expanded=True if day==0 else False):
167
- st.markdown(f"""
168
- <div class="day-card">
169
- <h3>{st.session_state.content_plan.split('\\n')[day*5]}</h3>
170
- <p>🎯 Objective: {st.session_state.content_plan.split('\\n')[day*5+1]}</p>
171
- <p>πŸ“Ή Format: {st.session_state.content_plan.split('\\n')[day*5+2]}</p>
172
- <p>πŸ’‘ Engagement Strategy: {st.session_state.content_plan.split('\\n')[day*5+3]}</p>
173
- <p>πŸ“ˆ Success Metrics: {st.session_state.content_plan.split('\\n')[day*5+4]}</p>
174
- </div>
175
- """,
176
- unsafe_allow_html=True
177
- )
 
 
 
 
 
 
 
178
 
179
  # Download button
180
  st.download_button(
 
164
  for day in range(10):
165
  current_date = start_date + timedelta(days=day)
166
  with st.expander(f"Day {day+1} - {current_date.strftime('%b %d')}", expanded=True if day==0 else False):
167
+ # Use .split('\n') instead of f-string splitting
168
+ plan_lines = st.session_state.content_plan.split('\n')
169
+
170
+ # Calculate start index, accounting for potential inconsistent line counts
171
+ start_index = day * 5
172
+ if start_index + 4 < len(plan_lines):
173
+ st.markdown(
174
+ f"""
175
+ <div class="day-card">
176
+ <h3>{plan_lines[start_index] if start_index < len(plan_lines) else 'No Topic'}</h3>
177
+ <p>🎯 Objective: {plan_lines[start_index+1] if start_index+1 < len(plan_lines) else 'N/A'}</p>
178
+ <p>πŸ“Ή Format: {plan_lines[start_index+2] if start_index+2 < len(plan_lines) else 'N/A'}</p>
179
+ <p>πŸ’‘ Engagement Strategy: {plan_lines[start_index+3] if start_index+3 < len(plan_lines) else 'N/A'}</p>
180
+ <p>πŸ“ˆ Success Metrics: {plan_lines[start_index+4] if start_index+4 < len(plan_lines) else 'N/A'}</p>
181
+ </div>
182
+ """,
183
+ unsafe_allow_html=True
184
+ )
185
 
186
  # Download button
187
  st.download_button(