Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import gradio as gr
|
|
| 2 |
from PIL import Image
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
CUSTOM_CSS = """
|
| 6 |
CUSTOM_CSS = """
|
| 7 |
.gradio-container{
|
| 8 |
background: white !important;
|
|
@@ -31,56 +30,50 @@ button{
|
|
| 31 |
|
| 32 |
/* Navbar bottom border */
|
| 33 |
.gradio-container > div:first-child {
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
}
|
| 38 |
"""
|
| 39 |
-
"""
|
| 40 |
|
| 41 |
-
IMG_PATH = "assets/file cabinet.png" #
|
|
|
|
| 42 |
|
| 43 |
-
def
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
return None
|
| 48 |
-
except:
|
| 49 |
-
return None
|
| 50 |
-
return Image.open(IMG_PATH)
|
| 51 |
|
| 52 |
-
with gr.Blocks(css=CUSTOM_CSS) as demo:
|
| 53 |
-
}
|
| 54 |
-
# ---------- NAVBAR ----------
|
| 55 |
-
with gr.Row():
|
| 56 |
-
with gr.Column(scale=2):
|
| 57 |
-
gr.HTML(
|
| 58 |
-
"""
|
| 59 |
-
<div style="display:flex; align-items:center;">
|
| 60 |
-
<img src="file=assets/logo.png"
|
| 61 |
-
style="height:40px; margin-right:10px;">
|
| 62 |
-
<span style="font-weight:700; font-size:18px;">Election Archive</span>
|
| 63 |
-
</div>
|
| 64 |
-
"""
|
| 65 |
-
)
|
| 66 |
|
|
|
|
|
|
|
| 67 |
with gr.Column(scale=6):
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
with gr.Column(scale=
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
| 84 |
# How To Keep
|
| 85 |
# Your Files
|
| 86 |
# Organized
|
|
@@ -88,11 +81,15 @@ with gr.Row():
|
|
| 88 |
### Turn your newsroom archive into a searchable memory engine.
|
| 89 |
### Upload documents. Ask questions. Get answers with sources.
|
| 90 |
""")
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
demo.launch()
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
import os
|
| 4 |
|
|
|
|
| 5 |
CUSTOM_CSS = """
|
| 6 |
.gradio-container{
|
| 7 |
background: white !important;
|
|
|
|
| 30 |
|
| 31 |
/* Navbar bottom border */
|
| 32 |
.gradio-container > div:first-child {
|
| 33 |
+
border-bottom: 1px solid #e5e7eb;
|
| 34 |
+
padding-bottom: 20px;
|
| 35 |
+
margin-bottom: 40px;
|
| 36 |
}
|
| 37 |
"""
|
|
|
|
| 38 |
|
| 39 |
+
IMG_PATH = "assets/file cabinet.png" # your hero image
|
| 40 |
+
LOGO_PATH = "assets/logo.png" # your logo image (upload this)
|
| 41 |
|
| 42 |
+
def load_image(path: str):
|
| 43 |
+
if os.path.exists(path):
|
| 44 |
+
return Image.open(path)
|
| 45 |
+
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
with gr.Blocks(css=CUSTOM_CSS, title="Election Memory Engine") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
# ---------- NAVBAR ----------
|
| 50 |
+
with gr.Row():
|
| 51 |
with gr.Column(scale=6):
|
| 52 |
+
# Use HTML so logo displays reliably on Spaces
|
| 53 |
+
gr.HTML(
|
| 54 |
+
f"""
|
| 55 |
+
<div style="display:flex; align-items:center; gap:10px;">
|
| 56 |
+
<img src="file={LOGO_PATH}" style="height:40px;">
|
| 57 |
+
<span style="font-weight:700; font-size:18px;">Election Archive</span>
|
| 58 |
+
</div>
|
| 59 |
+
"""
|
| 60 |
+
)
|
| 61 |
|
| 62 |
+
with gr.Column(scale=6):
|
| 63 |
+
gr.HTML(
|
| 64 |
+
"""
|
| 65 |
+
<div style="display:flex; justify-content:flex-end; gap:28px; font-weight:500;">
|
| 66 |
+
<span style="cursor:pointer;">Home</span>
|
| 67 |
+
<span style="cursor:pointer;">Archive</span>
|
| 68 |
+
<span style="cursor:pointer;">Upload</span>
|
| 69 |
+
</div>
|
| 70 |
+
"""
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
# ---------- HERO ----------
|
| 74 |
+
with gr.Row():
|
| 75 |
+
with gr.Column(scale=6):
|
| 76 |
+
gr.Markdown("""
|
| 77 |
# How To Keep
|
| 78 |
# Your Files
|
| 79 |
# Organized
|
|
|
|
| 81 |
### Turn your newsroom archive into a searchable memory engine.
|
| 82 |
### Upload documents. Ask questions. Get answers with sources.
|
| 83 |
""")
|
| 84 |
+
with gr.Row():
|
| 85 |
+
gr.Button("Get Started", variant="primary")
|
| 86 |
+
gr.Button("Upload Archive")
|
| 87 |
|
| 88 |
+
with gr.Column(scale=6):
|
| 89 |
+
hero = load_image(IMG_PATH)
|
| 90 |
+
if hero is None:
|
| 91 |
+
gr.Markdown(f"**Missing image:** `{IMG_PATH}` (check Files → assets)")
|
| 92 |
+
else:
|
| 93 |
+
gr.Image(value=hero, show_label=False, container=False)
|
| 94 |
|
| 95 |
demo.launch()
|