Sina Media Lab commited on
Commit
1596a24
Β·
1 Parent(s): 8aa4295
Files changed (1) hide show
  1. app.py +25 -19
app.py CHANGED
@@ -163,26 +163,29 @@ if selected_category:
163
  selected_module_data = module_data
164
  break
165
 
166
- # Display black background title with PDF report button
167
- st.markdown(
168
- f"""
169
- <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
170
- <span style='font-size: 18px; color: white;'>{selected_category} > {selected_module_data['title']}</span>
171
- </div>
172
- """,
173
- unsafe_allow_html=True
174
- )
 
 
175
 
176
- # Show PDF report button, initially disabled until a question is answered
177
- pdf_disabled = len(st.session_state.questions) == 0
178
- st.download_button(
179
- label="πŸ“„ Download PDF Report",
180
- data=st.session_state.pdf_data if not pdf_disabled else b'',
181
- file_name="quiz_report.pdf",
182
- mime="application/pdf",
183
- disabled=pdf_disabled,
184
- key="pdf_download_button"
185
- )
 
186
 
187
  if selected_module != st.session_state.current_module:
188
  st.session_state.current_module = selected_module
@@ -258,6 +261,9 @@ if submit_button:
258
  # Generate the PDF report data after each submission
259
  st.session_state.pdf_data = generate_pdf_report()
260
 
 
 
 
261
  # Refresh the PDF button state
262
  st.download_button(
263
  label="πŸ“„ Download PDF Report",
 
163
  selected_module_data = module_data
164
  break
165
 
166
+ # Create a horizontal layout with the category title and the PDF download button
167
+ col1, col2 = st.columns([3, 1])
168
+ with col1:
169
+ st.markdown(
170
+ f"""
171
+ <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
172
+ <span style='font-size: 18px; color: white;'>{selected_category} > {selected_module_data['title']}</span>
173
+ </div>
174
+ """,
175
+ unsafe_allow_html=True
176
+ )
177
 
178
+ with col2:
179
+ # Show PDF report button, initially disabled until a question is answered
180
+ pdf_disabled = len(st.session_state.questions) == 0
181
+ st.download_button(
182
+ label="πŸ“„ Download PDF Report",
183
+ data=st.session_state.pdf_data if not pdf_disabled else b'',
184
+ file_name="quiz_report.pdf",
185
+ mime="application/pdf",
186
+ disabled=pdf_disabled,
187
+ key="pdf_download_button"
188
+ )
189
 
190
  if selected_module != st.session_state.current_module:
191
  st.session_state.current_module = selected_module
 
261
  # Generate the PDF report data after each submission
262
  st.session_state.pdf_data = generate_pdf_report()
263
 
264
+ # Generate a new question for the next round
265
+ st.session_state.current_question = generate_new_question(selected_category, selected_module, selected_module_data)
266
+
267
  # Refresh the PDF button state
268
  st.download_button(
269
  label="πŸ“„ Download PDF Report",