import gradio as gr from PIL import Image import os CUSTOM_CSS = """ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&display=swap'); .gradio-container{ background: white !important; font-family: 'IBM Plex Mono', monospace !important; } /* Headings */ h1{ font-size:52px !important; font-weight:800 !important; line-height:1.05 !important; letter-spacing:-1px; } h3{ color:#6b7280 !important; font-weight:400 !important; } /* Buttons */ button{ border-radius: 12px !important; padding: 12px 24px !important; font-weight: 600 !important; } /* Navbar bottom border */ .gradio-container > div:first-child { border-bottom: 1px solid #e5e7eb; padding-bottom: 20px; margin-bottom: 26px; } """ IMG_PATH = "assets/file cabinet.png" # hero image LOGO_PATH = "assets/archive logo.png" # logo image def load_image(path: str): if os.path.exists(path): return Image.open(path) return None with gr.Blocks(css=CUSTOM_CSS, title="Election Memory Engine") as demo: # ---------- NAVBAR ---------- with gr.Row(): with gr.Column(scale=1, min_width=70): logo = load_image(LOGO_PATH) if logo is not None: gr.Image(value=logo, show_label=False, container=False, height=44) else: gr.Markdown(f"Missing: {LOGO_PATH}") with gr.Column(scale=5): gr.Markdown( "
Election Archive
" ) with gr.Column(scale=6): gr.HTML( """
Home Archive Upload
""" ) # ---------- HERO ---------- with gr.Row(): with gr.Column(scale=6): gr.Markdown(""" # What Happened # Last # Election? ### Turn your newsroom archive into a searchable memory engine. ### Upload documents. Ask questions. Get answers with sources. """) with gr.Row(): gr.Button("Get Started", variant="primary") gr.Button("Upload Archive") with gr.Column(scale=6): hero = load_image(IMG_PATH) if hero is not None: gr.Image(value=hero, show_label=False, container=False) else: gr.Markdown(f"**Missing hero image:** `{IMG_PATH}`") demo.launch()