Spaces:
Sleeping
Sleeping
Restore front page family preview renderings
Browse files
app.py
CHANGED
|
@@ -252,6 +252,15 @@ gradio-app,
|
|
| 252 |
font-weight: 700;
|
| 253 |
}
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
.record-book {
|
| 256 |
padding: 10px 0 0;
|
| 257 |
}
|
|
@@ -551,6 +560,7 @@ gradio-app,
|
|
| 551 |
justify-content: flex-start !important;
|
| 552 |
text-align: left !important;
|
| 553 |
white-space: normal !important;
|
|
|
|
| 554 |
}
|
| 555 |
|
| 556 |
.preview-card {
|
|
@@ -1138,6 +1148,20 @@ def family_card(summary: dict[str, Any], coordinates: dict[str, dict[str, Any]])
|
|
| 1138 |
"""
|
| 1139 |
|
| 1140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1141 |
def family_page_html(setup: str | None = None) -> str:
|
| 1142 |
choices = setup_choices()
|
| 1143 |
setup = setup if setup in choices else (choices[0] if choices else "")
|
|
@@ -1408,12 +1432,15 @@ with gr.Blocks(title="Packing Benchmark") as demo:
|
|
| 1408 |
gr.Markdown("### All families")
|
| 1409 |
family_buttons: list[tuple[str, gr.Button]] = []
|
| 1410 |
family_choices = setup_choices()
|
|
|
|
| 1411 |
with gr.Group(elem_classes=["family-button-shell"]):
|
| 1412 |
for row_start in range(0, len(family_choices), 3):
|
| 1413 |
with gr.Row():
|
| 1414 |
for setup in family_choices[row_start : row_start + 3]:
|
| 1415 |
-
|
| 1416 |
-
|
|
|
|
|
|
|
| 1417 |
home_family_page = gr.HTML(empty_family_html())
|
| 1418 |
|
| 1419 |
with gr.Tab("Family Records"):
|
|
|
|
| 252 |
font-weight: 700;
|
| 253 |
}
|
| 254 |
|
| 255 |
+
.front-family-card {
|
| 256 |
+
min-height: 232px;
|
| 257 |
+
margin-bottom: 8px;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.front-family-card .family-render {
|
| 261 |
+
height: 154px;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
.record-book {
|
| 265 |
padding: 10px 0 0;
|
| 266 |
}
|
|
|
|
| 560 |
justify-content: flex-start !important;
|
| 561 |
text-align: left !important;
|
| 562 |
white-space: normal !important;
|
| 563 |
+
margin-bottom: 12px !important;
|
| 564 |
}
|
| 565 |
|
| 566 |
.preview-card {
|
|
|
|
| 1148 |
"""
|
| 1149 |
|
| 1150 |
|
| 1151 |
+
def front_family_card_html(setup: str, coordinates: dict[str, dict[str, Any]]) -> str:
|
| 1152 |
+
return f"""
|
| 1153 |
+
<div class="family-card front-family-card">
|
| 1154 |
+
{family_preview(setup, coordinates)}
|
| 1155 |
+
<div class="family-card-top">
|
| 1156 |
+
<div>
|
| 1157 |
+
<div class="family-code">{esc(setup)}</div>
|
| 1158 |
+
<h3>{esc(setup_title(setup))}</h3>
|
| 1159 |
+
</div>
|
| 1160 |
+
</div>
|
| 1161 |
+
</div>
|
| 1162 |
+
"""
|
| 1163 |
+
|
| 1164 |
+
|
| 1165 |
def family_page_html(setup: str | None = None) -> str:
|
| 1166 |
choices = setup_choices()
|
| 1167 |
setup = setup if setup in choices else (choices[0] if choices else "")
|
|
|
|
| 1432 |
gr.Markdown("### All families")
|
| 1433 |
family_buttons: list[tuple[str, gr.Button]] = []
|
| 1434 |
family_choices = setup_choices()
|
| 1435 |
+
family_coordinates = coordinate_records_by_case()
|
| 1436 |
with gr.Group(elem_classes=["family-button-shell"]):
|
| 1437 |
for row_start in range(0, len(family_choices), 3):
|
| 1438 |
with gr.Row():
|
| 1439 |
for setup in family_choices[row_start : row_start + 3]:
|
| 1440 |
+
with gr.Column(scale=1):
|
| 1441 |
+
gr.HTML(front_family_card_html(setup, family_coordinates))
|
| 1442 |
+
button = gr.Button("Open records", size="sm")
|
| 1443 |
+
family_buttons.append((setup, button))
|
| 1444 |
home_family_page = gr.HTML(empty_family_html())
|
| 1445 |
|
| 1446 |
with gr.Tab("Family Records"):
|