feat: add logo
Browse files- Logo horizontal medium copie 4_CREME.png +0 -0
- app.py +75 -12
Logo horizontal medium copie 4_CREME.png
ADDED
|
app.py
CHANGED
|
@@ -14,6 +14,7 @@ deploying to Hugging Face Spaces).
|
|
| 14 |
|
| 15 |
from __future__ import annotations
|
| 16 |
|
|
|
|
| 17 |
import random
|
| 18 |
from typing import Any, Dict, List, Optional, Tuple
|
| 19 |
|
|
@@ -128,6 +129,65 @@ DEFAULT_WINDOWINGS: Dict[str, Optional[Dict[str, int]]] = {
|
|
| 128 |
"oasis": None,
|
| 129 |
}
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
# ---------------------------------------------------------------------------
|
| 133 |
# Utility helpers
|
|
@@ -496,18 +556,21 @@ def handle_upload_preview(
|
|
| 496 |
|
| 497 |
|
| 498 |
def build_demo() -> gr.Blocks:
|
| 499 |
-
with gr.Blocks(css=
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
|
|
|
|
|
|
|
|
|
| 511 |
|
| 512 |
default_head = "kits"
|
| 513 |
head_dropdown = gr.Dropdown(
|
|
|
|
| 14 |
|
| 15 |
from __future__ import annotations
|
| 16 |
|
| 17 |
+
import base64
|
| 18 |
import random
|
| 19 |
from typing import Any, Dict, List, Optional, Tuple
|
| 20 |
|
|
|
|
| 129 |
"oasis": None,
|
| 130 |
}
|
| 131 |
|
| 132 |
+
LOGO_PATH = "Logo horizontal medium copie 4_CREME.png"
|
| 133 |
+
|
| 134 |
+
CUSTOM_CSS = """
|
| 135 |
+
.gr-prose { max-width: 900px; }
|
| 136 |
+
#app-hero {
|
| 137 |
+
display: flex;
|
| 138 |
+
align-items: center;
|
| 139 |
+
gap: 2.5rem;
|
| 140 |
+
margin-bottom: 1.5rem;
|
| 141 |
+
padding-right: 1.5rem;
|
| 142 |
+
}
|
| 143 |
+
#app-hero .hero-text {
|
| 144 |
+
flex: 1;
|
| 145 |
+
padding-right: 1rem;
|
| 146 |
+
}
|
| 147 |
+
#app-hero .hero-text h1 {
|
| 148 |
+
font-size: 2.25rem;
|
| 149 |
+
margin-bottom: 0.5rem;
|
| 150 |
+
}
|
| 151 |
+
#app-hero .hero-text p {
|
| 152 |
+
margin: 0.25rem 0;
|
| 153 |
+
line-height: 1.5;
|
| 154 |
+
}
|
| 155 |
+
#app-hero .hero-logo img {
|
| 156 |
+
max-height: 60px;
|
| 157 |
+
width: auto;
|
| 158 |
+
display: block;
|
| 159 |
+
}
|
| 160 |
+
@media (max-width: 768px) {
|
| 161 |
+
#app-hero {
|
| 162 |
+
flex-direction: column;
|
| 163 |
+
text-align: center;
|
| 164 |
+
padding-right: 0;
|
| 165 |
+
}
|
| 166 |
+
#app-hero .hero-text {
|
| 167 |
+
padding-right: 0;
|
| 168 |
+
}
|
| 169 |
+
#app-hero .hero-text h1,
|
| 170 |
+
#app-hero .hero-text p {
|
| 171 |
+
text-align: center;
|
| 172 |
+
}
|
| 173 |
+
#app-hero .hero-logo img {
|
| 174 |
+
margin: 0 auto 1rem;
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def load_logo_data_uri() -> str:
|
| 181 |
+
try:
|
| 182 |
+
with open(LOGO_PATH, "rb") as logo_file:
|
| 183 |
+
encoded = base64.b64encode(logo_file.read()).decode("ascii")
|
| 184 |
+
return f"data:image/png;base64,{encoded}"
|
| 185 |
+
except FileNotFoundError:
|
| 186 |
+
return ""
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
LOGO_DATA_URI = load_logo_data_uri()
|
| 190 |
+
|
| 191 |
|
| 192 |
# ---------------------------------------------------------------------------
|
| 193 |
# Utility helpers
|
|
|
|
| 556 |
|
| 557 |
|
| 558 |
def build_demo() -> gr.Blocks:
|
| 559 |
+
with gr.Blocks(css=CUSTOM_CSS) as demo:
|
| 560 |
+
logo_block = ""
|
| 561 |
+
if LOGO_DATA_URI:
|
| 562 |
+
logo_block = f'<div class="hero-logo"><img src="{LOGO_DATA_URI}" alt="Curia logo" /></div>'
|
| 563 |
+
hero_html = f"""
|
| 564 |
+
<div id=\"app-hero\">
|
| 565 |
+
{logo_block}
|
| 566 |
+
<div class=\"hero-text\">
|
| 567 |
+
<h1>Curia Model Playground</h1>
|
| 568 |
+
<p>Experiment with the multi-head Curia models on CuriaBench evaluation data or your own medical images.</p>
|
| 569 |
+
<p>Each head expects a single 2D slice in the Curia-defined plane/orientation (PL axial, IL coronal, IP sagittal) with raw Hounsfield units (CT) or normalised MRI intensities.</p>
|
| 570 |
+
</div>
|
| 571 |
+
</div>
|
| 572 |
+
"""
|
| 573 |
+
gr.HTML(hero_html)
|
| 574 |
|
| 575 |
default_head = "kits"
|
| 576 |
head_dropdown = gr.Dropdown(
|