import base64, mimetypes from html import escape from pathlib import Path import streamlit as st # ========= PATHS (subfolder-safe) ========= BASE_DIR = Path(__file__).parent # -> Landing_Page/ ASSETS = BASE_DIR / "assets" # -> Landing_Page/assets/ # ========= CONTROLS (tweak these) ========= HERO_LOGO_SIZE = 160 # px (top company logo size) TOP_SPACER = 100 # px (breathing room above hero; raise if the logo looks "trimmed") CARD_WIDTH = 300 # px (fixed width per card on desktop) CARD_THUMB_HEIGHT = 120 # px (image area inside each card) GRID_GAP = 80 # px (space between the cards) BUTTON_TEXT = "Click to Run APP" OPEN_IN_NEW_TAB = False # True = open links in a new tab # ========= BRAND / APPS ========= COMPANY_NAME = "Smart Thinking" TAGLINE = "We Deliver Smart AI-Based Solutions For O&G Industry" APP1 = { "title": "ST_GeoMech", "url": "https://smart-thinking-ai-suite-geomech.hf.space", "thumb": ASSETS / "app1.png", "blurb": "Real-Time UCS Prediction", "bg": "#F7FBFF", # very light blue "border":"#E8F2FF", # light blue border } APP2 = { "title": "ST_TOC", "url": "https://smart-thinking-gr.hf.space/", "thumb": ASSETS / "app2.png", "blurb": "Real-Time GR Log Prediction", "bg": "#F6FFF7", # very light green "border":"#E4F9E6", # light green border } # NEW third card (edit title/url/blurb/thumb/colors as needed) APP3 = { "title": "ST_Perm", "url": "https://example.com/", # <-- replace with your Space URL "thumb": ASSETS / "app3.png", # <-- upload this image "blurb": "Describe your third app here", "bg": "#F9F6FF", # very light purple "border":"#EDE6FF", # light purple border } APP4 = { "title": "ST_Porosity", "url": "https://example.com/", # <-- replace with your Space URL "thumb": ASSETS / "app3.png", # <-- upload this image "blurb": "Describe your third app here", "bg": "#F9F6FF", # very light purple "border":"#EDE6FF", # light purple border } LOGO_PATH = ASSETS / "logo.png" # ========= PAGE META ========= page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭" st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide") # ========= CSS (fits one screen on desktop; no blank area under cards) ========= st.markdown( f""" """, unsafe_allow_html=True, ) # ========= IMAGE HELPERS ========= def data_uri(path: Path) -> str | None: if not path.exists(): return None mime, _ = mimetypes.guess_type(path.name) if not mime: mime = "image/png" b64 = base64.b64encode(path.read_bytes()).decode("utf-8") return f"data:{mime};base64,{b64}" def img_tag(path: Path, alt: str, cls: str) -> str: uri = data_uri(path) if uri: return f'{escape(alt)}' return f'
{escape(alt)}
' # ========= HERO ========= st.markdown( '
' + (img_tag(LOGO_PATH, "logo", "") if LOGO_PATH.exists() else "") + f"

{escape(COMPANY_NAME)}

" + f"

{escape(TAGLINE)}

" + "
", unsafe_allow_html=True, ) # ========= CARDS ========= def app_card(app: dict) -> str: target = "_blank" if OPEN_IN_NEW_TAB else "_self" style = f"--card-bg:{app.get('bg','#fff')}; --card-border:{app.get('border','rgba(0,0,0,.06)')};" return ( f"
" + img_tag(app["thumb"], app["title"], "thumb") + f"

{escape(app['title'])}

" + f"

{escape(app['blurb'])}

" + f"{escape(BUTTON_TEXT)}" + "
" ) # Render 3 cards side-by-side st.markdown("
" + app_card(APP1) + app_card(APP2) + app_card(APP3) + "
", unsafe_allow_html=True) # ========= FOOTER (compact; no extra spacing) ========= st.markdown( """
""", unsafe_allow_html=True, )