ankanghosh commited on
Commit
d63526b
·
verified ·
1 Parent(s): c5ce3c5

Update app,py

Browse files
Files changed (1) hide show
  1. app.py +28 -20
app.py CHANGED
@@ -46,12 +46,6 @@ def toggle_acknowledgment():
46
  # Custom styling (pure CSS)
47
  st.markdown("""
48
  <style>
49
- .main-title {
50
- font-size: 2.5rem;
51
- color: #c0392b;
52
- text-align: center;
53
- margin-bottom: 1rem;
54
- }
55
  /* Button styling */
56
  .stButton>button {
57
  background-color: #fff0f0 !important;
@@ -170,10 +164,38 @@ div.stInfo {
170
  border-top: 1px solid #eee;
171
  margin-top: 30px;
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  </style>
174
  <div class="main-title">Spirituality Q&A</div>
175
  """, unsafe_allow_html=True)
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  # Preload resources during initialization
178
  init_message = st.empty()
179
  if not st.session_state.initialized:
@@ -196,20 +218,6 @@ elif st.session_state.init_time is not None:
196
  init_message.empty()
197
  st.session_state.init_time = None
198
 
199
- # Heartfelt acknowledgment section with toggle - improved button text and disabled during processing
200
- if st.session_state.show_acknowledgment:
201
- st.markdown('<div class="thank-you-button">', unsafe_allow_html=True)
202
- # Debouncing applied: disabled if processing
203
- if st.button("Hide Thank You Note", on_click=toggle_acknowledgment, disabled=st.session_state.is_processing):
204
- pass
205
- st.markdown('</div>', unsafe_allow_html=True)
206
- else:
207
- st.markdown('<div class="thank-you-button">', unsafe_allow_html=True)
208
- # Debouncing applied: disabled if processing
209
- if st.button("Show Thank You Note", on_click=toggle_acknowledgment, disabled=st.session_state.is_processing):
210
- pass
211
- st.markdown('</div>', unsafe_allow_html=True)
212
-
213
  if st.session_state.show_acknowledgment:
214
  st.markdown('<div class="acknowledgment-container">', unsafe_allow_html=True)
215
  st.markdown('<div class="acknowledgment-header">A Heartfelt Thank You</div>', unsafe_allow_html=True)
 
46
  # Custom styling (pure CSS)
47
  st.markdown("""
48
  <style>
 
 
 
 
 
 
49
  /* Button styling */
50
  .stButton>button {
51
  background-color: #fff0f0 !important;
 
164
  border-top: 1px solid #eee;
165
  margin-top: 30px;
166
  }
167
+ /* Center align title */
168
+ .main-title {
169
+ font-size: 2.5rem;
170
+ color: #c0392b;
171
+ text-align: center;
172
+ margin-bottom: 1rem;
173
+ }
174
+ /* Button container for centering */
175
+ .center-container {
176
+ display: flex;
177
+ justify-content: center;
178
+ margin: 0 auto;
179
+ width: 100%;
180
+ }
181
  </style>
182
  <div class="main-title">Spirituality Q&A</div>
183
  """, unsafe_allow_html=True)
184
 
185
+ # Centered button layout without columns
186
+ _, center_col, _ = st.columns([1, 2, 1]) # Create a wider center column
187
+ with center_col: # Put everything in the center column
188
+ if st.session_state.show_acknowledgment:
189
+ st.markdown('<div class="thank-you-button">', unsafe_allow_html=True)
190
+ if st.button("Hide Thank You Note", on_click=toggle_acknowledgment, disabled=st.session_state.is_processing, use_container_width=True):
191
+ pass
192
+ st.markdown('</div>', unsafe_allow_html=True)
193
+ else:
194
+ st.markdown('<div class="thank-you-button">', unsafe_allow_html=True)
195
+ if st.button("Show Thank You Note", on_click=toggle_acknowledgment, disabled=st.session_state.is_processing, use_container_width=True):
196
+ pass
197
+ st.markdown('</div>', unsafe_allow_html=True)
198
+
199
  # Preload resources during initialization
200
  init_message = st.empty()
201
  if not st.session_state.initialized:
 
218
  init_message.empty()
219
  st.session_state.init_time = None
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  if st.session_state.show_acknowledgment:
222
  st.markdown('<div class="acknowledgment-container">', unsafe_allow_html=True)
223
  st.markdown('<div class="acknowledgment-header">A Heartfelt Thank You</div>', unsafe_allow_html=True)