Spaces:
Sleeping
Sleeping
Rawal Khirodkar commited on
Commit ·
b211eaf
1
Parent(s): 1e56adf
Seg: rename label to 'Outputs (29 classes)', vertical legend right of overlay, active opacity 0.70, heights 640
Browse files
app.py
CHANGED
|
@@ -204,17 +204,25 @@ CUSTOM_CSS = """
|
|
| 204 |
#seg-out .mask { opacity: 0.55 !important;
|
| 205 |
transition: opacity 180ms ease, filter 180ms ease; }
|
| 206 |
#seg-out .image-container:hover .mask { opacity: 0.15 !important; }
|
| 207 |
-
#seg-out .mask.active { opacity:
|
| 208 |
-
filter: brightness(1.
|
| 209 |
#seg-out .mask.inactive { opacity: 0 !important; }
|
| 210 |
|
| 211 |
-
/* Legend:
|
| 212 |
-
#seg-out .
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
#seg-out .legend-item { font-size: 12px; font-weight: 500;
|
| 215 |
-
padding:
|
|
|
|
| 216 |
transition: transform 140ms ease, background 140ms ease; }
|
| 217 |
-
#seg-out .legend-item:hover { transform:
|
| 218 |
"""
|
| 219 |
|
| 220 |
HEADER_HTML = """
|
|
@@ -243,11 +251,11 @@ with gr.Blocks(title="Sapiens2 Seg", theme=gr.themes.Soft(), css=CUSTOM_CSS) as
|
|
| 243 |
gr.HTML(HEADER_HTML)
|
| 244 |
|
| 245 |
with gr.Row(equal_height=True):
|
| 246 |
-
inp = gr.Image(label="Input", type="pil", height=
|
| 247 |
out_annot = gr.AnnotatedImage(
|
| 248 |
-
label="
|
| 249 |
color_map=_CLASS_COLORS_HEX,
|
| 250 |
-
height=
|
| 251 |
show_legend=True,
|
| 252 |
elem_id="seg-out",
|
| 253 |
)
|
|
|
|
| 204 |
#seg-out .mask { opacity: 0.55 !important;
|
| 205 |
transition: opacity 180ms ease, filter 180ms ease; }
|
| 206 |
#seg-out .image-container:hover .mask { opacity: 0.15 !important; }
|
| 207 |
+
#seg-out .mask.active { opacity: 0.70 !important;
|
| 208 |
+
filter: brightness(1.12) drop-shadow(0 4px 14px rgba(0,0,0,0.30)); }
|
| 209 |
#seg-out .mask.inactive { opacity: 0 !important; }
|
| 210 |
|
| 211 |
+
/* Legend: vertical column on the right of the image instead of horizontal below. */
|
| 212 |
+
#seg-out .container { flex-direction: row !important; align-items: stretch !important; gap: 12px; }
|
| 213 |
+
#seg-out .image-container { flex: 1 1 auto; min-width: 0; }
|
| 214 |
+
#seg-out .legend {
|
| 215 |
+
flex: 0 0 180px; flex-direction: column !important; flex-wrap: nowrap !important;
|
| 216 |
+
align-items: stretch; justify-content: flex-start;
|
| 217 |
+
gap: 4px; padding: 8px 4px;
|
| 218 |
+
max-height: 640px; overflow-y: auto;
|
| 219 |
+
border-left: 1px solid var(--border-color-primary, #e2e8f0);
|
| 220 |
+
}
|
| 221 |
#seg-out .legend-item { font-size: 12px; font-weight: 500;
|
| 222 |
+
padding: 4px 10px; width: 100%; cursor: pointer;
|
| 223 |
+
border-radius: 6px;
|
| 224 |
transition: transform 140ms ease, background 140ms ease; }
|
| 225 |
+
#seg-out .legend-item:hover { transform: translateX(2px); }
|
| 226 |
"""
|
| 227 |
|
| 228 |
HEADER_HTML = """
|
|
|
|
| 251 |
gr.HTML(HEADER_HTML)
|
| 252 |
|
| 253 |
with gr.Row(equal_height=True):
|
| 254 |
+
inp = gr.Image(label="Input", type="pil", height=640)
|
| 255 |
out_annot = gr.AnnotatedImage(
|
| 256 |
+
label="Outputs (29 classes)",
|
| 257 |
color_map=_CLASS_COLORS_HEX,
|
| 258 |
+
height=640,
|
| 259 |
show_legend=True,
|
| 260 |
elem_id="seg-out",
|
| 261 |
)
|