nalin0503 commited on
Commit
759a26f
Β·
1 Parent(s): 708f462

Align results page to left

Browse files
Files changed (1) hide show
  1. app.py +54 -10
app.py CHANGED
@@ -100,6 +100,12 @@ def main():
100
  margin-right: auto;
101
  width: 200px;
102
  }
 
 
 
 
 
 
103
  .header-title {
104
  text-align: center;
105
  font-size: 2.8rem;
@@ -158,6 +164,13 @@ def main():
158
  50% { opacity: 1; }
159
  100% { opacity: 0.6; }
160
  }
 
 
 
 
 
 
 
161
  </style>
162
  """,
163
  unsafe_allow_html=True
@@ -170,12 +183,22 @@ def main():
170
  st.error("Please make sure all required scripts are in the same directory as this Streamlit app.")
171
  return
172
 
173
- # Load logo for all pages
174
  logo_path = "metamorphLogo_nobg.png"
175
- if os.path.exists(logo_path):
 
 
 
176
  try:
177
  logo = Image.open(logo_path)
178
  logo_base64 = get_img_as_base64(logo)
 
 
 
 
 
 
 
179
  st.markdown(
180
  f"""
181
  <div style="text-align: center;">
@@ -184,13 +207,9 @@ def main():
184
  """,
185
  unsafe_allow_html=True
186
  )
187
- except Exception as e:
188
- st.warning(f"Logo could not be loaded: {e}")
189
-
190
- st.markdown("<h1 class='header-title'>Metamorph Web App</h1>", unsafe_allow_html=True)
191
-
192
- # =============== INPUT PAGE ===============
193
- if st.session_state.page == 'input':
194
  st.markdown(
195
  """
196
  <p style='text-align: center; font-size: 1.1rem;'>
@@ -350,6 +369,19 @@ def main():
350
 
351
  # =============== PROCESSING PAGE ===============
352
  elif st.session_state.page == 'processing':
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  st.markdown(
354
  """
355
  <div class="processing-container">
@@ -488,9 +520,21 @@ def main():
488
 
489
  # =============== RESULT PAGE ===============
490
  elif st.session_state.page == 'result':
 
 
 
 
 
 
 
 
 
 
 
 
491
  st.markdown(
492
  """
493
- <div style="text-align: center;">
494
  <h2>Morphing Complete! πŸŽ‰</h2>
495
  <p>Your morphing video has been successfully generated. You can download it below.</p>
496
  </div>
 
100
  margin-right: auto;
101
  width: 200px;
102
  }
103
+ /* Left-aligned logo for results page */
104
+ .header-logo-left {
105
+ display: block;
106
+ margin-right: auto;
107
+ width: 200px;
108
+ }
109
  .header-title {
110
  text-align: center;
111
  font-size: 2.8rem;
 
164
  50% { opacity: 1; }
165
  100% { opacity: 0.6; }
166
  }
167
+ /* Left-aligned results content */
168
+ .results-container h2 {
169
+ text-align: left;
170
+ }
171
+ .results-container p {
172
+ text-align: left;
173
+ }
174
  </style>
175
  """,
176
  unsafe_allow_html=True
 
183
  st.error("Please make sure all required scripts are in the same directory as this Streamlit app.")
184
  return
185
 
186
+ # Load logo path for all pages
187
  logo_path = "metamorphLogo_nobg.png"
188
+ logo_exists = os.path.exists(logo_path)
189
+ logo_base64 = None
190
+
191
+ if logo_exists:
192
  try:
193
  logo = Image.open(logo_path)
194
  logo_base64 = get_img_as_base64(logo)
195
+ except Exception as e:
196
+ st.warning(f"Logo could not be loaded: {e}")
197
+
198
+ # =============== INPUT PAGE ===============
199
+ if st.session_state.page == 'input':
200
+ # Display centered logo and title for input page
201
+ if logo_exists and logo_base64:
202
  st.markdown(
203
  f"""
204
  <div style="text-align: center;">
 
207
  """,
208
  unsafe_allow_html=True
209
  )
210
+
211
+ st.markdown("<h1 class='header-title'>Metamorph Web App</h1>", unsafe_allow_html=True)
212
+
 
 
 
 
213
  st.markdown(
214
  """
215
  <p style='text-align: center; font-size: 1.1rem;'>
 
369
 
370
  # =============== PROCESSING PAGE ===============
371
  elif st.session_state.page == 'processing':
372
+ # Display centered logo for processing page
373
+ if logo_exists and logo_base64:
374
+ st.markdown(
375
+ f"""
376
+ <div style="text-align: center;">
377
+ <img src="data:image/png;base64,{logo_base64}" class="header-logo-large" alt="Metamorph Logo">
378
+ </div>
379
+ """,
380
+ unsafe_allow_html=True
381
+ )
382
+
383
+ st.markdown("<h1 class='header-title'>Metamorph Web App</h1>", unsafe_allow_html=True)
384
+
385
  st.markdown(
386
  """
387
  <div class="processing-container">
 
520
 
521
  # =============== RESULT PAGE ===============
522
  elif st.session_state.page == 'result':
523
+ # Display left-aligned logo for results page (no title)
524
+ if logo_exists and logo_base64:
525
+ st.markdown(
526
+ f"""
527
+ <div>
528
+ <img src="data:image/png;base64,{logo_base64}" class="header-logo-left" alt="Metamorph Logo">
529
+ </div>
530
+ """,
531
+ unsafe_allow_html=True
532
+ )
533
+
534
+ # Left-aligned content for results page
535
  st.markdown(
536
  """
537
+ <div class="results-container">
538
  <h2>Morphing Complete! πŸŽ‰</h2>
539
  <p>Your morphing video has been successfully generated. You can download it below.</p>
540
  </div>