Spaces:
Sleeping
Sleeping
abraham9486937737
commited on
Commit
·
a77dd7c
1
Parent(s):
68ff299
Simplify logo loading: prioritize streamlit_app directory
Browse files- streamlit_app/app.py +30 -33
streamlit_app/app.py
CHANGED
|
@@ -247,45 +247,42 @@ with st.sidebar:
|
|
| 247 |
try:
|
| 248 |
from PIL import Image
|
| 249 |
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
Path(project_root) / "mypace-logo.png", # root/mypace-logo.png
|
| 253 |
-
Path.cwd() / "mypace-logo.png", # cwd/mypace-logo.png
|
| 254 |
-
]
|
| 255 |
-
|
| 256 |
-
# Add all parent directories
|
| 257 |
-
for parent in Path(__file__).resolve().parents:
|
| 258 |
-
logo_candidates.append(parent / "mypace-logo.png")
|
| 259 |
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
logo_img = Image.open(logo_path)
|
| 271 |
st.image(logo_img, use_container_width=True)
|
| 272 |
-
|
| 273 |
-
#
|
| 274 |
-
|
| 275 |
-
else:
|
| 276 |
-
# File not found, try URL
|
| 277 |
-
hf_logo_url = "https://huggingface.co/spaces/abrahamcbe/myspace-ooty-analytics/resolve/main/mypace-logo.png"
|
| 278 |
-
try:
|
| 279 |
-
st.image(hf_logo_url, use_container_width=True)
|
| 280 |
-
except Exception:
|
| 281 |
-
# Use base64 embedded image
|
| 282 |
try:
|
| 283 |
-
|
| 284 |
-
st.image(f"data:image/png;base64,{logo_b64}", use_container_width=True)
|
| 285 |
except Exception:
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
except Exception as e:
|
| 288 |
-
# Last resort: emoji
|
| 289 |
st.markdown("<h1 style='text-align: center; font-size: 80px;'>🏨</h1>", unsafe_allow_html=True)
|
| 290 |
|
| 291 |
st.title("🏨 MySpace Ooty Holiday Inn")
|
|
|
|
| 247 |
try:
|
| 248 |
from PIL import Image
|
| 249 |
|
| 250 |
+
# Try to load logo from streamlit_app directory first (most direct path)
|
| 251 |
+
logo_direct = Path(__file__).parent / "mypace-logo.png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
+
if logo_direct.exists():
|
| 254 |
+
# Load directly from streamlit_app folder
|
| 255 |
+
logo_img = Image.open(logo_direct)
|
| 256 |
+
st.image(logo_img, use_container_width=True)
|
| 257 |
+
else:
|
| 258 |
+
# Fallback: Try other paths
|
| 259 |
+
logo_candidates = [
|
| 260 |
+
Path(project_root) / "mypace-logo.png",
|
| 261 |
+
Path.cwd() / "mypace-logo.png",
|
| 262 |
+
]
|
| 263 |
+
|
| 264 |
+
logo_path = None
|
| 265 |
+
for candidate in logo_candidates:
|
| 266 |
+
if candidate.exists():
|
| 267 |
+
logo_path = candidate
|
| 268 |
+
break
|
| 269 |
+
|
| 270 |
+
if logo_path:
|
| 271 |
logo_img = Image.open(logo_path)
|
| 272 |
st.image(logo_img, use_container_width=True)
|
| 273 |
+
else:
|
| 274 |
+
# Try HF URL
|
| 275 |
+
hf_logo_url = "https://huggingface.co/spaces/abrahamcbe/myspace-ooty-analytics/resolve/main/mypace-logo.png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
try:
|
| 277 |
+
st.image(hf_logo_url, use_container_width=True)
|
|
|
|
| 278 |
except Exception:
|
| 279 |
+
# Use base64
|
| 280 |
+
try:
|
| 281 |
+
logo_b64 = "".join(LOGO_B64.split())
|
| 282 |
+
st.image(f"data:image/png;base64,{logo_b64}", use_container_width=True)
|
| 283 |
+
except Exception:
|
| 284 |
+
st.markdown("<h1 style='text-align: center; font-size: 80px;'>🏨</h1>", unsafe_allow_html=True)
|
| 285 |
except Exception as e:
|
|
|
|
| 286 |
st.markdown("<h1 style='text-align: center; font-size: 80px;'>🏨</h1>", unsafe_allow_html=True)
|
| 287 |
|
| 288 |
st.title("🏨 MySpace Ooty Holiday Inn")
|