chenemii commited on
Commit
975c17a
·
1 Parent(s): 6baea5b

Fix logo display for Hugging Face deployment

Browse files

- Fix logo path to work correctly on Hugging Face
- Add fallback paths for different deployment environments
- Improve logo sizing (850px -> 600px) for better responsiveness
- Add CSS for better centering and mobile compatibility
- Enhanced error handling for logo loading

Files changed (1) hide show
  1. app/streamlit_app.py +32 -2
app/streamlit_app.py CHANGED
@@ -624,6 +624,21 @@ def main():
624
  margin-bottom: 10px;
625
  }
626
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
627
 
628
 
629
 
@@ -656,8 +671,23 @@ def main():
656
 
657
  with col2:
658
  try:
659
- st.image("app/par-ity project horizontal logo.png", width=850)
660
- except:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  st.markdown('<div class="main-header"><h1>⛳ Par-ity Project</h1></div>', unsafe_allow_html=True)
662
 
663
  with col3:
 
624
  margin-bottom: 10px;
625
  }
626
 
627
+ /* Logo styling for better centering and responsiveness */
628
+ .stImage > img {
629
+ display: block;
630
+ margin-left: auto;
631
+ margin-right: auto;
632
+ max-width: 100%;
633
+ height: auto;
634
+ }
635
+
636
+ /* Ensure logo container is centered */
637
+ .stImage {
638
+ text-align: center;
639
+ width: 100%;
640
+ }
641
+
642
 
643
 
644
 
 
671
 
672
  with col2:
673
  try:
674
+ # Try multiple possible paths for the logo file
675
+ logo_paths = [
676
+ "par-ity project horizontal logo.png", # Direct path in current directory
677
+ "app/par-ity project horizontal logo.png", # Original path for local development
678
+ "./par-ity project horizontal logo.png" # Explicit current directory
679
+ ]
680
+
681
+ logo_loaded = False
682
+ for logo_path in logo_paths:
683
+ if os.path.exists(logo_path):
684
+ st.image(logo_path, width=600) # Reduced width for better mobile compatibility
685
+ logo_loaded = True
686
+ break
687
+
688
+ if not logo_loaded:
689
+ st.markdown('<div class="main-header"><h1>⛳ Par-ity Project</h1></div>', unsafe_allow_html=True)
690
+ except Exception as e:
691
  st.markdown('<div class="main-header"><h1>⛳ Par-ity Project</h1></div>', unsafe_allow_html=True)
692
 
693
  with col3: