Sina Media Lab commited on
Commit
f0a1b24
·
1 Parent(s): a2ef5f6
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -136,14 +136,19 @@ if selected_module != st.session_state.current_module:
136
 
137
  current_question = st.session_state.current_question
138
 
139
- # Display the PDF report button and clock on the same horizontal level
 
 
 
 
140
  col1, col2 = st.columns([1, 3])
141
 
 
142
  with col1:
143
- st.write("⏱️")
144
- st.write(f"{int(time.time() - st.session_state.start_time)} seconds")
 
145
  with col2:
146
- # Generate PDF report only if there is at least one answered question
147
  if any(q['answered'] for q in st.session_state.questions):
148
  pdf = generate_pdf_report()
149
  st.session_state.pdf_data = pdf # Reset PDF cache
@@ -154,9 +159,10 @@ with col2:
154
  mime="application/pdf"
155
  )
156
 
157
- # Display module title and description with a larger font for description
158
- st.markdown(f"### {modules[selected_module]['title']}")
159
- st.markdown(f"<span style='font-size: 14px;'>{modules[selected_module]['description']}</span>", unsafe_allow_html=True)
 
160
 
161
  # Display the current question with larger font
162
  st.markdown(f"<span style='font-size: 18px;'><b>Q{st.session_state.current_index + 1}: {current_question['question']}</b></span>", unsafe_allow_html=True)
 
136
 
137
  current_question = st.session_state.current_question
138
 
139
+ # Display module title and description with a larger font for description
140
+ st.markdown(f"### {modules[selected_module]['title']}")
141
+ st.markdown(f"<span style='font-size: 14px;'>{modules[selected_module]['description']}</span>", unsafe_allow_html=True)
142
+
143
+ # Create a horizontal layout for the clock and PDF report button
144
  col1, col2 = st.columns([1, 3])
145
 
146
+ # Live ticking clock
147
  with col1:
148
+ clock_placeholder = st.empty()
149
+
150
+ # Display the PDF report button
151
  with col2:
 
152
  if any(q['answered'] for q in st.session_state.questions):
153
  pdf = generate_pdf_report()
154
  st.session_state.pdf_data = pdf # Reset PDF cache
 
159
  mime="application/pdf"
160
  )
161
 
162
+ # Update the clock every second
163
+ while True:
164
+ clock_placeholder.markdown(f"⏱️ {int(time.time() - st.session_state.start_time)} seconds")
165
+ time.sleep(1)
166
 
167
  # Display the current question with larger font
168
  st.markdown(f"<span style='font-size: 18px;'><b>Q{st.session_state.current_index + 1}: {current_question['question']}</b></span>", unsafe_allow_html=True)