Update app.py
Browse files
app.py
CHANGED
|
@@ -238,16 +238,16 @@ def render_sample_view(df_filtered: pd.DataFrame, index: int):
|
|
| 238 |
meta_raw = row.get("metadata", "")
|
| 239 |
meta_raw = meta_raw if isinstance(meta_raw, str) else str(meta_raw)
|
| 240 |
|
| 241 |
-
# Gallery (
|
| 242 |
gallery_items = [
|
| 243 |
-
("Marked / Original"
|
| 244 |
-
("Original"
|
| 245 |
-
("Solution"
|
| 246 |
-
("Mask"
|
| 247 |
-
("Cell map"
|
| 248 |
]
|
| 249 |
# remove None images
|
| 250 |
-
gallery_items = [(
|
| 251 |
|
| 252 |
status_md = f"**Sample** `{sid}` \n**Index** `{index}` / `{len(df_filtered)-1}`"
|
| 253 |
return index, status_md, instruction, gallery_items, meta_json, meta_raw
|
|
|
|
| 238 |
meta_raw = row.get("metadata", "")
|
| 239 |
meta_raw = meta_raw if isinstance(meta_raw, str) else str(meta_raw)
|
| 240 |
|
| 241 |
+
# Gallery: Gradio expects (image, caption) per item
|
| 242 |
gallery_items = [
|
| 243 |
+
(marked, "Marked / Original"),
|
| 244 |
+
(original, "Original"),
|
| 245 |
+
(sol, "Solution"),
|
| 246 |
+
(mask, "Mask"),
|
| 247 |
+
(cell_map, "Cell map"),
|
| 248 |
]
|
| 249 |
# remove None images
|
| 250 |
+
gallery_items = [(img, cap) for (img, cap) in gallery_items if img is not None]
|
| 251 |
|
| 252 |
status_md = f"**Sample** `{sid}` \n**Index** `{index}` / `{len(df_filtered)-1}`"
|
| 253 |
return index, status_md, instruction, gallery_items, meta_json, meta_raw
|