SHELLAPANDIANGANHUNGING commited on
Commit
9f04e44
·
verified ·
1 Parent(s): 999d9f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -36
app.py CHANGED
@@ -248,42 +248,45 @@ with st.container():
248
 
249
  # ================= LOGO (Perbaikan: Base64 Embed - Selalu Muncul) =================
250
  # ================= LOGO (Pakai File Lokal - Selalu Muncul di Pojok Kanan Atas) =================
251
- def render_logo():
252
- # Gunakan st.image() untuk memuat file lokal
253
- # Pastikan file 'logo.png' ada di folder yang sama dengan script Anda
254
- try:
255
- st.markdown(
256
- """
257
- <style>
258
- .logo-container {
259
- position: fixed;
260
- top: 20px;
261
- right: 20px;
262
- z-index: 9999;
263
- background: white;
264
- padding: 6px;
265
- border-radius: 10px;
266
- box-shadow: 0 2px 8px rgba(0,0,0,0.1);
267
- border: 1px solid #e0e0e0;
268
- }
269
- </style>
270
- """,
271
- unsafe_allow_html=True
272
- )
273
- # Tampilkan logo dengan ukuran yang sesuai
274
- st.markdown('<div class="logo-container">', unsafe_allow_html=True)
275
- st.image("logo.png", width=120) # Sesuaikan width jika perlu
276
- st.markdown('</div>', unsafe_allow_html=True)
277
- except FileNotFoundError:
278
- # Jika file tidak ditemukan, tampilkan pesan
279
- st.warning(f"⚠️ Logo file 'logo.png' not found. Please ensure it's in the same directory.")
280
- # Opsional: tampilkan placeholder
281
- st.markdown(
282
- '<div style="position:fixed; top:20px; right:20px; z-index:9999; background:white; padding:6px; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,0.1); border:1px solid #e0e0e0;">'
283
- '<span style="font-size:14px; color:#666;">Logo</span>'
284
- '</div>',
285
- unsafe_allow_html=True
286
- )
 
 
 
287
 
288
  # ================= SIDEBAR FILTERS =================
289
  with st.sidebar:
 
248
 
249
  # ================= LOGO (Perbaikan: Base64 Embed - Selalu Muncul) =================
250
  # ================= LOGO (Pakai File Lokal - Selalu Muncul di Pojok Kanan Atas) =================
251
+ import os
252
+ import streamlit as st
253
+
254
+ # ================= PATH AMAN (WAJIB) =================
255
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
256
+
257
+ LOGO_MICHELIN = os.path.join(BASE_DIR, "logo.png")
258
+ LOGO_BTECH = os.path.join(BASE_DIR, "btech.png")
259
+
260
+ # ================= HEADER =================
261
+ with st.container():
262
+ col1, col2, col3 = st.columns([1.5, 6, 1.5])
263
+
264
+ # LEFT — Michelin Logo
265
+ with col1:
266
+ if os.path.exists(LOGO_MICHELIN):
267
+ st.image(LOGO_MICHELIN, width=140)
268
+ else:
269
+ st.markdown("**Michelin**")
270
+
271
+ # CENTER — Title
272
+ with col2:
273
+ st.markdown("""
274
+ <div style="text-align:center;">
275
+ <h1 style="margin:0; color:#154D9C; font-weight:800;">
276
+ Tyre Pressure Monitoring System (TPMS) Analytics for Mining Equipments
277
+ </h1>
278
+ <p style="font-size:12px; color:#7d7d7d; margin-top:6px;">
279
+ Daily trend insights derived from 13–16 December 2023 data
280
+ </p>
281
+ </div>
282
+ """, unsafe_allow_html=True)
283
+
284
+ # RIGHT — BTech Logo
285
+ with col3:
286
+ if os.path.exists(LOGO_BTECH):
287
+ st.image(LOGO_BTECH, width=140)
288
+ else:
289
+ st.markdown("**BTech**")
290
 
291
  # ================= SIDEBAR FILTERS =================
292
  with st.sidebar: