Spaces:
Sleeping
Sleeping
Download app.py from Lilymutinda/Election_Archive_Dup: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/spaces/Lilymutinda/Election_Archive_Dup/resolve/main/app.py
- Command line
-
hf download hf://spaces/Lilymutinda/Election_Archive_Dup/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Lilymutinda/Election_Archive_Dup/resolve/main/app.py
2.73 kB
| 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"<span style='color:#6b7280;font-size:12px;'>Missing: {LOGO_PATH}</span>") | |
| with gr.Column(scale=5): | |
| gr.Markdown( | |
| "<div style='font-weight:700; font-size:18px; padding-top:6px;'>Election Archive</div>" | |
| ) | |
| with gr.Column(scale=6): | |
| gr.HTML( | |
| """ | |
| <div style="display:flex; justify-content:flex-end; gap:28px; font-weight:500; padding-top:10px;"> | |
| <span style="cursor:pointer;">Home</span> | |
| <span style="cursor:pointer;">Archive</span> | |
| <span style="cursor:pointer;">Upload</span> | |
| </div> | |
| """ | |
| ) | |
| # ---------- 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() |